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

Comments

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

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

to:

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

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

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

Oh and maybe cherry-pick

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

How to Host a Blog on a Subdirectory Instead of a Subdomain

https://www.davidma.co/blog/2025-11-14-host-your-blog-on-a-subdirectory/
1•taikon•1m ago•0 comments

Young Men and Women Use AI Differently

https://youngmenresearchinitiative.substack.com/p/young-men-and-women-use-ai-differently
1•m-hodges•1m ago•0 comments

Jury trials set to be axed for most crimes under major shake up

https://www.legalcheek.com/2025/11/jury-trials-set-to-be-axed-for-most-crimes-under-major-shake-up/
1•jjgreen•2m ago•0 comments

Leaderboard for AI Predictors

https://futurex-ai.github.io/
1•SCEtoAux•3m ago•0 comments

Notepad++ Flagged in National Vulnerability Database

https://nvd.nist.gov/vuln/detail/CVE-2025-56383
1•carodgers•3m ago•1 comments

ICE Offers Up to $280M to Immigrant-Tracking 'Bounty Hunter' Firms

https://www.wired.com/story/ice-bounty-hunter-spy-program/
1•zzzeek•4m ago•0 comments

How to repurpose your old phone's GPS modem into a web server

https://blog.nns.ee/2021/04/01/modem-blog
1•xx_ns•8m ago•1 comments

Commodore CHESSmate

https://benlo.com/microchess/chessmate.html
2•naves•8m ago•0 comments

Ubihealthd (2015)

https://lwn.net/Articles/663751/
1•reflexe•9m ago•0 comments

Show HN: An AI interface to understand anything, better than NotebookLM

https://www.kerns.ai/
1•kanodiaayush•9m ago•0 comments

Free Ircam Technologies

https://forum.ircam.fr/collections/detail/technologies-ircam-free/
1•ofrzeta•10m ago•0 comments

Indian detained in Shanghai airport is detained and told "You're Chinese"

https://timesofindia.indiatimes.com/india/youre-chinese-arunachal-woman-harassed-by-shanghai-airp...
2•ilamont•12m ago•0 comments

A New Bridge Links the Math of Infinity to Computer Science

https://www.quantamagazine.org/a-new-bridge-links-the-strange-math-of-infinity-to-computer-scienc...
2•digital55•13m ago•0 comments

GTM Engineering Has a Context Problem

https://www.octavehq.com/post/gtm-engineering-has-a-context-problem
3•cmogni1•15m ago•0 comments

Talagrand's convolution conjecture up to log log via perturbed reverse heat

https://arxiv.org/abs/2511.19374
1•tzury•16m ago•0 comments

Generate changelog using Git Commits and AI with single Python script

https://github.com/BrowseWiki/genlog
1•laotoutou•17m ago•0 comments

How to Improve Your Attention Span: Daniel Pink's Strategies for the Digital Age

https://www.openculture.com/2025/11/how-to-improve-your-attention-span.html
1•frenzcan•20m ago•0 comments

UK intends to scrap jury trials for majority of court cases

https://www.gbnews.com/politics/uk/david-lammy-scrap-jury-trials
6•cbeach•21m ago•0 comments

The Bughouse Effect

https://tsvibt.blogspot.com/2025/11/the-bughouse-effect.html
1•surprisetalk•22m ago•0 comments

A Matter of Millimeters: The story of Qantas flight 32

https://admiralcloudberg.medium.com/a-matter-of-millimeters-the-story-of-qantas-flight-32-bdaa62d...
2•surprisetalk•22m ago•0 comments

Requiem for Early Blogging

https://www.elizabethspiers.com/requiem-for-early-blogging/
1•AIBytes•24m ago•0 comments

Humans to Mars [NASA]

https://www.nasa.gov/humans-in-space/humans-to-mars/
1•indigodaddy•24m ago•1 comments

ProfitMate AI Premium

https://profitmateai-web.web.app/
1•Brizmo•25m ago•1 comments

How good are social scientists at forecasting?

https://www.nber.org/papers/w34493
2•oatsandsugar•31m ago•1 comments

Unison 1.0 Release

https://www.unison-lang.org/unison-1-0/
26•pchiusano•33m ago•1 comments

Treat AI-Generated code as a draft

https://addyo.substack.com/p/treat-ai-generated-code-as-a-draft
2•janpio•34m ago•0 comments

Venture in Public Markets

https://parthchopra.substack.com/p/venture-in-public-markets
1•probe•36m ago•0 comments

AI Can Help Reduce Wildfire Risks

https://www.bloomberg.com/news/newsletters/2025-11-25/how-ai-can-help-reduce-wildfire-risks
1•toomuchtodo•37m ago•1 comments

Does Memo from Sunday Robotics have a soul?

https://andyfromthefuture.substack.com/p/does-memo-from-sunday-robotics-have
1•charliejordan•42m ago•0 comments

Ask HN: I feel like I've lost my motivation to continue learning programming

2•eng_ask•42m ago•0 comments