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•11mo ago

Comments

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

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

to:

  git sync "descriptive name"
horsawlarway•11mo 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•11mo 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•11mo 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•11mo ago
That sounds better but I like the granularity I get from scrutinizing specific files or the patch takes too long to review.
speff•11mo 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•11mo 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•11mo 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•11mo ago
Maybe not essential, but reflog is invaluable.

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

foobarkey•11mo ago
Remove merge and add rebase and we agree :)

Oh and maybe cherry-pick

seba_dos1•11mo ago
Both are essential.
realaleris149•11mo ago
There are other commands?
incomplete•11mo 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•11mo ago
i can't take this seriously if there's no mention of the '--amend' option and 'rebase' command
OutOfHere•11mo ago
It missed "git switch" and "git restore".

X Asks Court to Dismiss Music Piracy Lawsuit After Supreme Court's Cox Ruling

https://torrentfreak.com/x-asks-court-to-dismiss-music-piracy-lawsuit-after-supreme-courts-cox-ru...
1•gslin•2m ago•0 comments

Mullenweg to Cloudflare: Keep WordPress Out of Your Mouth

https://www.searchenginejournal.com/mullenweg-to-cloudflare-keep-wordpress-out-of-your-mouth/571119/
3•ValentineC•4m ago•0 comments

Treason? Yes Apple Bows to Kremlin Removes over 190 Major Apps

https://novayagazeta.eu/articles/2026/03/31/apple-reveals-it-bowed-to-kremlin-pressure-to-remove-...
2•casey2•6m ago•0 comments

Banning All Anthropic Employees

https://joeyh.name/blog/entry/banning_all_Anthropic_employees/
5•edward•14m ago•0 comments

German implementation of eIDAS will require an Apple/Google account to function

https://bmi.usercontent.opencode.de/eudi-wallet/wallet-development-documentation-public/latest/ar...
3•DyslexicAtheist•14m ago•0 comments

Hermes Agent: The self-improving open source AI agent Complete Guide for 2026

https://virtualuncle.com/hermes-agent-complete-guide-2026/
4•svrbvr•15m ago•1 comments

Why your joints make noise

https://news.virginia.edu/content/qa-do-your-joints-sound-rice-krispies-uva-expert-explains-why
4•bookofjoe•15m ago•0 comments

Why we see clear details: study reveals how the eye makes sharp vision possible

https://www.uab.edu/news/research-innovation/why-we-see-clear-details-uab-study-reveals-how-the-e...
4•hhs•16m ago•0 comments

Show HN: Artemis.fyi – Real-time tracker for the Artemis II Moon mission

https://artemis.fyi/
5•dmk•23m ago•0 comments

Ewigkeitsglühbirne (Eternal Light Bulb)

https://de.wikipedia.org/wiki/Ewigkeitsgl%C3%BChbirne
3•doener•23m ago•0 comments

AI can describe human experiences but lacks experience in an actual body: study

https://www.uclahealth.org/news/release/ai-can-describe-human-experiences-lacks-experience-actual-2
4•hhs•27m ago•0 comments

America is heading for a recession – and it may be the worst yet

https://thehill.com/opinion/finance/5814974-middle-class-decline-permanent-crisis/
10•malshe•30m ago•1 comments

Show HN: Chrome extension prototype for cross-tab/frame network interception

https://github.com/vsromanc/framelink
1•vsromanc•30m ago•1 comments

Companies' website traffic predicts financial performance and stock returns

https://newsroom.haas.berkeley.edu/companies-website-traffic-proves-powerful-predictor-of-financi...
2•hhs•33m ago•0 comments

Are we building IDEs for engineers anymore?

https://shub.club/writings/2026/april/who-are-these-ides-for/
3•forthwall•39m ago•1 comments

Show HN: Tmuzika – terminal music player in C (v1.1.2)

https://github.com/ivanjeka/tmuzika
1•ivanjeka•41m ago•0 comments

Claude Code caches unredacted session history and secrets in plaintext

https://github.com/anthropics/claude-code/issues/43675
1•rctruta•43m ago•0 comments

I'm 16 and just published my first Python library – QuantX

https://github.com/aaravchour/quantx
1•aaravchour•44m ago•0 comments

Sleeping sickness drug simplifies treatment, raising hopes for eradication

https://www.science.org/content/article/truly-spectacular-drug-sleeping-sickness-simplifies-treat...
2•MaysonL•45m ago•0 comments

The Iran war highlights the creeping use of AI in warfare

https://www.chathamhouse.org/2026/03/iran-war-highlights-creeping-use-ai-warfare
3•_____k•46m ago•0 comments

Show HN: Ray – an open-source AI financial advisor that runs in your terminal

https://rayfinance.app
6•kaniksu•50m ago•2 comments

Show HN: Cadenza – Connect Wandb logs to agents easily for autonomous research

https://github.com/mylucaai/cadenza
2•hgarud•52m ago•0 comments

Subway Challenge

https://en.wikipedia.org/wiki/Subway_Challenge
2•skogstokig•52m ago•0 comments

Digger – Back and Digitally Remastered

https://www.digger.org/
2•bananaboy•53m ago•0 comments

Rescue team in Iran face 'harrowing and dangerous' search for US crew member

https://www.bbc.com/news/articles/c0le43jw8e9o
5•asdefghyk•55m ago•2 comments

Show HN: SwarmFeed – An X-like social platform built for AI agents

https://www.swarmfeed.ai/
2•jamesweb•58m ago•0 comments

The Republican Party Has a Nazi Problem

https://www.theatlantic.com/magazine/2026/04/republican-party-nazi-problem/686055/
10•tastyface•58m ago•2 comments

Show HN: Nelson, a Ralph-like loop for finding vulnerabilities

https://github.com/swelljoe/nelson
2•SwellJoe•1h ago•1 comments

With the right cache, multiple 800K Opus sessions are still affordable

https://matrix.dev/blog-2026-04-04
2•yuanzhi1203•1h ago•0 comments

Previously untranslated or unpublished writings of Leibniz published next month

https://dailynous.com/2026/03/27/lots-more-leibniz/
3•danielam•1h ago•0 comments