frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Git Commands That Cover 90% of a Developer's Daily Workflow

https://jsdev.space/15-git-commands/
29•javatuts•1y ago

Comments

epmatsw•1y ago
restore and maybe switch are the two missing ones I think. Rebase for me, but that’s preference. Cherry-pick too.
rentonl•1y ago
my co-workers used to think I was an expert in git. In reality, they memorized 7 commands while I memorized 15
hbogert•1y ago
i memorized that a commit tree is a ordered set of patches. Everything goes from there.
Areibman•1y ago
In similar fashion, this site has saved me countless hours fixing common git issues https://ohshitgit.com
the__alchemist•1y ago
I need to alias:

  git add .
  git commit -am "descriptive name"
  git push

to:

  git sync "descriptive name"
horsawlarway•1y ago
personally - skip the 'git add .'

It's a pretty terrible habit to get into, and will (not can - will) cause all sorts of headaches. From minor ones like personal editor configs getting dumped into the projects, all the way up to major ones like secrets ending up in your git history.

If you want something close, but much better, do something like:

    if [[ -n $(git ls-files --others --exclude-standard) ]]; then
        echo "There are untracked files.  Please add, remove, or ignore them."
    else
        git commit -am "descriptive name"
        git push
    fi
the__alchemist•1y ago
I see your point, but find it worth it for convenience. Ultimately git is a tool I use to get the job done, and I want it out of the way. 99% of the time, I just want to sync my project, which doesn't only mean edits to existing files.
open-paren•1y ago
How about `git add --patch -all` to make it interactive? I have that aliased to `gap` and it is probably my most used git command.
cholantesh•1y ago
That sounds better but I like the granularity I get from scrutinizing specific files or the patch takes too long to review.
speff•1y ago
I'd like to suggest also mentioning `git add -p` (--prompt). It's very helpful for just adding changes relevant to the commit
nickcw•1y ago
No `git rebase`?

Here are my stats for my last 300 or so git commands from my history

    $ history | grep git | awk '{print $3}' | sort | uniq -c | sort -rn

     71 log
     44 show
     34 diff
     26 co # alias for checkout
     24 cherry-pick
     23 status
     18 brs # alias for branch -v --sort=-committerdate
     13 rebase
     11 commit
     11 add
      8 push
      4 archive
      3 reset
      2 pull
      1 grep
      1 checkout
      1 br
Been doing lots of tricky merges recently hence all the cherry-picks! Not normally such a large part of my workflow.
mercer•1y ago
For me, I generally don't go far beyond the commands in the article, but I /do/ make a lot of use of git rebase -i in my branches.
karmakaze•1y ago
Maybe not essential, but reflog is invaluable.

I also like to separate fetch from pull (fetch + merge).

foobarkey•1y ago
Remove merge and add rebase and we agree :)

Oh and maybe cherry-pick

seba_dos1•1y ago
Both are essential.
realaleris149•1y ago
There are other commands?
incomplete•1y ago
also gonna echo the same sentiment: where's rebase? :)

two other git log commands i find to be insanely useful are:

alias hlog='git log --date-order --graph --date=short --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ad%Creset %C(red bold)%d%Creset%s"'

and:

alias alog='git log --date-order --all --graph --date=short --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ad%Creset %C(red bold)%d%Creset%s"'

this is great when working in a repo w/a main "prod" branch that you don't commit to directly, but instead commit to "staging" or "dev". alog shows you the entire repo's history for all branches, and hlog is just the graph of the non-pushable branches (plus all feature branches).

hbogert•1y ago
i can't take this seriously if there's no mention of the '--amend' option and 'rebase' command
OutOfHere•1y ago
It missed "git switch" and "git restore".

NPM invalidates use of fine-grained tokens that bypass 2FA

https://docs.npmjs.com/trusted-publishers/
1•meander_water•3m ago•0 comments

How to Kill a Blog

https://robertbirming.com/how-kill-blog/
1•James72689•8m ago•0 comments

Your Read Model Doesn't Always Need a Database

https://docs.eventsourcingdb.io/blog/2026/05/21/your-read-model-doesnt-always-need-a-database/
1•goloroden•12m ago•0 comments

Show HN: ISSforAPUSH is conducting an "aggregated interview"

https://issforapush.netlify.app
1•audreyfei•19m ago•0 comments

Show HN: QuiteGPT – makes GPT response shorter

https://quiet-gpt.craftgarden.io/
1•leapoahead1•21m ago•0 comments

I made an AI Interior consultant

https://studio.mystofa.com/en-US
1•assorium•22m ago•0 comments

Bitcoin's Power Law: Weak Structure, Strong Forecasts

https://arxiv.org/abs/2605.21316
2•CarlosBaquero•23m ago•0 comments

Consciousness, Gödel, and the Boundary of the Box

https://twitter.com/VFD_org/status/2057053649315013042
1•__patchbit__•24m ago•0 comments

YAML? That's Norway Problem

https://lab174.com/blog/202601-yaml-norway/
1•theanonymousone•30m ago•1 comments

New on Platform

1•rockstaradi•32m ago•0 comments

Ye Olde RFC

https://github.com/gabinante/ye-olde-rfc
1•oooyay•32m ago•0 comments

Nostr-VPN Is one of the most useful things in open source

https://git.iris.to/#/npub1xdhnr9mrv47kkrn95k6cwecearydeh8e895990n3acntwvmgk2dsdeeycm/nostr-vpn
1•abhsag24•33m ago•0 comments

70% of Faculty Vote to Overhaul Harvard Grading with a Cap

https://www.thecrimson.com/article/2026/5/20/fas-passes-a-grade-cap/
1•k2enemy•33m ago•0 comments

List of Alleged Extraterrestrial Beings

https://en.wikipedia.org/wiki/List_of_alleged_extraterrestrial_beings
3•thunderbong•38m ago•0 comments

Software engineering is the tipping point [video]

https://www.youtube.com/watch?v=9t9Kj2f6wtU
1•azhenley•40m ago•0 comments

The Mysterious XF86AudioPlay Issue

https://michael-prokop.at/blog/2026/05/20/the-mysterious-xf86audioplay-issue/
2•JNRowe•45m ago•0 comments

VPNs: The "Most Trusted" Security Tool Until Claude Roasts It in a Weekend

https://www.hacktron.ai/blog/cve-2026-0265-panos-globalprotect-cas-auth-bypass
3•jordybg•46m ago•0 comments

Show HN: Macfigure – Mac configuration in pkl. Simple alternative to Nix-Darwin

https://github.com/Quintisimo/macfigure
1•quintisimo•47m ago•0 comments

Ask HN: Transition from Engineering Manager to IC

1•lavsv•48m ago•0 comments

The Secrets Revealed in SpaceX's IPO Filing

https://www.wsj.com/business/spacex-ipo-takeaways-cea33689
1•1vuio0pswjnm7•49m ago•0 comments

SpaceX Filing Reveals $4.28B Loss, Musk's Tight Grip (3)

https://news.bloomberglaw.com/capital-markets/musks-spacex-files-publicly-for-nasdaq-ipo-under-sy...
3•1vuio0pswjnm7•50m ago•0 comments

SpaceX IPO filing lays bare losses and Musk control as it stakes future on AI

https://www.reuters.com/legal/transactional/bound-mars-elon-musks-spacex-unveils-filing-blockbust...
3•1vuio0pswjnm7•51m ago•0 comments

Reconnecting. – – 5/5 why don't they fix codex

1•apoorvdarshan•53m ago•0 comments

Why is writing good test cases still painfully manual in 2026?

https://calendly.com/qualityfolio2026/30min
1•Daniel_Carter•54m ago•0 comments

Lazydiff: Terminal PR Review with AST-Aware Semantic Diff Rendering

https://github.com/Ataraxy-Labs/lazydiff
1•rohanucla•58m ago•0 comments

Is Python Becoming Pinyin?

https://lernerpython.com/2026/05/19/is-python-becoming-pinyin/
3•reuven•1h ago•0 comments

Rewrite System Showdown: Stochastic Search vs. EqSat

https://arxiv.org/abs/2605.19005
1•pcfwik•1h ago•0 comments

Scheme Interpreter

https://cs61a.org/proj/scheme/
1•HiPHInch•1h ago•0 comments

Understanding KV Cache: The Hidden Memory Cost of Serving LLMs

https://melchi.me/posts/kv-cache/
2•colescodes•1h ago•0 comments

Opn-Chat

https://opn-chat-v1-freebuff.vercel.app
1•fcapuz•1h ago•0 comments