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•12mo 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•12mo ago
i can't take this seriously if there's no mention of the '--amend' option and 'rebase' command
OutOfHere•12mo ago
It missed "git switch" and "git restore".

Coffee appears to rewire the gut-brain connection

https://www.sciencedaily.com/releases/2026/05/260502233911.htm
1•loh•2m ago•0 comments

Show HN: Interactive Marimo Moss Ball

https://github.com/ledhieu/imoss
1•ldhieu•4m ago•0 comments

Nerves in Skin Can Slow Melanoma Growth

https://news.weill.cornell.edu/news/2026/04/nerves-in-skin-can-slow-melanoma-growth
1•gmays•4m ago•0 comments

Ask HN: Do you feel reading AI generated readme tiring?

1•maytc•5m ago•0 comments

Verleer – Learn a language from any content

https://verleer.com
1•CallMePapi-_-•7m ago•0 comments

Pilots Shut Off Both Engines Before China Eastern 737 Crash

https://viewfromthewing.com/pilots-shut-off-both-engines-before-china-eastern-737-crash-china-cit...
1•qsi•15m ago•0 comments

Letters from Steve

https://davidgelphman.wordpress.com/2013/03/29/2-letters-from-steve/
1•prawn•23m ago•0 comments

ChatGPT Wrestles with Its Most Chilling Conversation: How Do I Plan an Attack?

https://www.wsj.com/us-news/chatgpt-mass-shooting-openai-78a436d1
1•Brajeshwar•25m ago•1 comments

OpenAI Codex system includes explicit directive to "never talk about goblins"

https://arstechnica.com/ai/2026/04/openai-codex-system-prompt-includes-explicit-directive-to-neve...
3•randycupertino•27m ago•2 comments

Checkpoint/Restore in Userspace (CRIU)

https://criu.org/Main_Page
1•htfy96•27m ago•0 comments

OpenJDK 25 Security Update Released

https://tux.re/forum/viewtopic.php?t=222
1•sys3000•28m ago•0 comments

Enabling Monoglot Programming

https://www.humprog.org/~stephen/blog/research/enabling-monoglot-programming.html
1•htfy96•36m ago•0 comments

The Shape of a Guitar Pick

https://www.johndcook.com/blog/2026/05/03/guitar-pick/
2•malshe•40m ago•0 comments

Quantum teleportation between two quantum dots demonstrated over 270M

https://www.sciencedaily.com/releases/2026/04/260429102030.htm
1•thegdsks•42m ago•0 comments

Ask HN: Does Claude Code succeed after being asked "should we give up?" for you?

4•webwielder2•46m ago•0 comments

Show HN VibeAI FoldSpace by HugonomySystems

https://hugonomy.com/
2•GlyphWeaver_a•46m ago•0 comments

Scientists discover 27 potential new planets that orbit two stars

https://www.theguardian.com/science/2026/may/04/scientists-discover-27-potential-new-planets
2•nhatcher•47m ago•0 comments

Make some art with your phone sensors

https://tautme.github.io/phone-sensors/sensor-etch.html
1•adm4•53m ago•0 comments

Why Almost Everyone Loses on Prediction Markets

https://www.wsj.com/finance/investing/polymarket-kalshi-betting-profits-prediction-markets-eb23ac11
2•tysone•53m ago•0 comments

Don't fly if you can help it

https://michaelbluejay.com/airfare/dontfly.html
1•cxr•1h ago•2 comments

The Rise of Emotional Surveillance

https://www.theatlantic.com/culture/2026/05/worker-surveillance-emotion-ai/687029/
2•eloisius•1h ago•0 comments

Show HN: ReflowPDF – wrote a layout engine because every PDF library failed

https://reflowpdf.com
1•exsol•1h ago•0 comments

Think pop music is basic? Even classical and jazz are getting less complex

https://connectsci.au/news/news-parent/9259/Think-pop-music-is-basic-Even-classical-and-jazz
1•gmays•1h ago•0 comments

Shoppers falsely identified by facial recognition system

https://www.theguardian.com/technology/2026/may/03/guilty-until-proven-innocent-shoppers-falsely-...
2•kayfox•1h ago•0 comments

GameStop Proposes to Acquire eBay at $125.00 per Share

https://investor.gamestop.com/news-releases/news-details/2026/GameStop-Proposes-to-Acquire-eBay-a...
5•tech234a•1h ago•3 comments

PicoServer: A glue library embedding web server for .NET, no IIS, no Kestrel

https://www.nuget.org/packages/PicoServer
1•myhackernew•1h ago•0 comments

PostgreSQL databases are boring on purpose

https://stormatics.tech/blogs/the-best-postgresql-databases-are-boring-on-purpose
2•pgdatabase•1h ago•0 comments

Unauthorized macOS port claiming Don Ho as an author?

https://github.com/notepad-plus-plus/notepad-plus-plus/issues/17982
7•jethronethro•1h ago•0 comments

Bluchan.org – Anonymous Free Speech Forum

https://www.bluchan.org
1•jjhbhjbj•1h ago•2 comments

Diatom

https://en.wikipedia.org/wiki/Diatom
1•lucaslazarus•1h ago•0 comments