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".

What happens when your blog hits #1 in Hacker News?

https://martinvol.pe/blog/2026/05/19/what-happens-when-your-blog-post-hits-1-in-hacker-news/
1•martinvol•46s ago•0 comments

Show HN: BigQuery Emulator – run Google BigQuery locally for tests

https://github.com/goccy/bigquery-emulator
1•goccy•4m ago•0 comments

The Modern Data Stack Is Dead. Who Killed It?

https://docs.fused.io/blog/modern-data-stack-is-dead/
1•MaxLenormand•5m ago•0 comments

The question Erlang answered in 1986 is back, one level up

https://adaptivesoftware.substack.com/p/the-stable-thing
2•iristenteije•7m ago•0 comments

The Signals That Matter – MIT Insider's Panel

https://www.technologyreview.com/2026/05/18/1137430/the-signals-that-matter-mit-insiders-panel/
1•joozio•8m ago•0 comments

OpenGeni – The Open Agent Runtime

https://opengeni.ai/
1•tckr•12m ago•1 comments

Show HN: Books ranked by how many Wikipedia article translations they have

https://likedbook.com/
2•nihilpista•12m ago•0 comments

Windows on Mobile Screen

1•tukunjil•12m ago•0 comments

RG40XXV Pocket Retro Computer: Amiga, Atari ST/XE, C64, Amstrad CPC with MuOS [video]

https://www.youtube.com/watch?v=BF2DLt0ZlXA
1•doener•13m ago•1 comments

A diff viewer GUI for Linux, built in Rust

https://revisa.guillerg.dev/
1•guille_•14m ago•0 comments

Tokoro – open, signed event protocol with LLM crawler

https://github.com/robertoranon/tokoro
1•robran•22m ago•0 comments

The Ecosystem Security Team at the PHP Foundation

https://thephp.foundation/blog/2026/05/18/announcing-ecosystem-security-team/
1•danielpetrica•22m ago•0 comments

Welcome to Order by Jungle

https://boringsql.com/posts/order-by-jungle/
1•gregnavis•23m ago•0 comments

Jury Hands Victory to Sam Altman and OpenAI in Battle with Elon Musk

https://www.theguardian.com/technology/2026/may/18/sam-altman-trial-victory-elon-musk-openai
1•beardyw•23m ago•0 comments

The big AI companies are going to see their margins disappear

https://www.theregister.com/ai-ml/2026/05/18/the-big-ai-companies-are-going-to-see-their-margins-...
1•Bender•24m ago•0 comments

Casuarina Linux: A Glibc-Based Chimera Linux Derivative

https://casuarina.org/news/introducing-casuarina-linux/
1•grigio•24m ago•0 comments

Legal fail: Don't use AI to sue Facebook users for calling you a bad date

https://arstechnica.com/tech-policy/2026/05/legal-fail-dont-use-ai-to-sue-facebook-users-for-call...
2•Bender•25m ago•0 comments

AI is likely to widen the gap between corporate giants and everyone else

https://finance.yahoo.com/markets/article/history-says-ai-is-likely-to-widen-the-gap-between-corp...
1•wslh•25m ago•0 comments

Ebola outbreak: WHO declares emergency, US restricts travel, American infected

https://arstechnica.com/health/2026/05/ebola-outbreak-who-declares-emergency-us-restricts-travel-...
2•Bender•26m ago•0 comments

Millions of merchants speak UCP

https://twitter.com/igrigorik/status/2056417991693312370
1•doppp•28m ago•0 comments

Googolplex Written Out

https://www.googolplexwrittenout.com/
1•syx•29m ago•0 comments

Gemini is in danger of going full Copilot

https://www.theverge.com/tech/931752/google-io-2026-gemini-icon-docs-workspace
1•ilreb•31m ago•0 comments

Gaussian Splat of a Strawberry

https://superspl.at/scene/84df8849
16•danybittel•31m ago•5 comments

Drug Development Failure: How GLP-1 Development Was Abandoned in 1990

https://muse.jhu.edu/verify?url=%2Farticle%2F936213&r=479323
1•Anon84•31m ago•0 comments

NosDAV: Nostr-native Solid storage server. Powered by JSS

https://nosdav.com/server/
1•sigalor•32m ago•0 comments

AdminForth – Open-source admin framework with a built-in AI agent [video]

https://www.youtube.com/watch?v=4tB8uzY__uk
1•nixy71•34m ago•0 comments

An open question about how AI agent skills should be distributed

https://github.com/hymhub/skill-indexer
1•1749207188•34m ago•0 comments

Trump admin creates $1.7B fund for allies of the president

https://www.cnn.com/2026/05/18/politics/trump-irs-lawsuit-fund-for-allies
5•tdeck•34m ago•0 comments

All the Bugs They Found

https://andreapivetta.com/posts/all-the-bugs-they-found.html
1•ziggy42•36m ago•0 comments

Show HN: Barstool, a Prettier macOS Menubar

https://barstool.lotl.dev/
1•thecommieaxo•36m ago•0 comments