frontpage.
newsnewestaskshowjobs

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

Go's map does not shrink

https://antonz.org/go-map-shrink/
1•valyala•1m ago•0 comments

Ask HN: What are you using for an IDE these days?

1•jaredwiener•2m ago•0 comments

The Happiest Mathematician in the World

https://nymag.com/intelligencer/article/kevin-buzzard-lean-math-ai-profile.html
1•digital55•2m ago•0 comments

Cheap Code, Expensive Trust

https://sergimansilla.com/blog/cheap-code-expensive-trust/
1•sergimansilla•3m ago•0 comments

Tesla scraps AI4.5 chip over memory bandwidth issues

https://www.reuters.com/business/autos-transportation/tesla-scraps-ai45-chip-over-memory-bandwidt...
1•mgh2•3m ago•0 comments

Fighting contact form slop with a model

https://www.coryd.dev/posts/2026/fighting-contact-form-slop-with-a-model
1•cdrnsf•3m ago•0 comments

Show HN: Merlin – An X-ray for Claude/codex/pi sessions (subagents, forks, cost)

https://merlin.dev
1•zsolt_terek•4m ago•0 comments

Unmodified 748B DeepSeek-v4.1-Flash on one RTX 4090

https://axel-labs.com/research/deepseek-v4-1-flash-on-one-rtx-4090
3•bobbitybobob•5m ago•0 comments

Robot gun dog sent into combat against gangs

https://www.telegraph.co.uk/world-news/2026/12/03/robot-gun-dogs-combat-first-time-haiti/
2•garbawarb•9m ago•0 comments

Bare-metal C LLM engine for a 2006 PS3 (150.7 tok/s, 137x llama.cpp)

https://github.com/veniallc/cell-llm
5•veniallc•11m ago•1 comments

Executing Instructions

https://www.kuniga.me/blog/2026/12/02/executing-instructions.html
1•speckx•14m ago•0 comments

With a Counterexample, Mathematicians Show That It's an Unfair World

https://www.quantamagazine.org/with-a-counterexample-mathematicians-show-that-its-an-unfair-world...
2•jonbaer•14m ago•0 comments

Notes on Alignment

https://borretti.me/article/notes-on-alignment
2•zetalyrae•14m ago•0 comments

How to Understand the NSA's and Big Tech's AI Encryption Warnings

https://www.wired.com/story/all-hands-on-deck-how-to-understand-the-nsas-and-big-techs-encryption...
2•jonbaer•17m ago•0 comments

More Canadian founders are building at home. Next question is where they sell

https://betakit.com/more-canadian-founders-are-building-at-home-the-next-question-is-where-they-s...
3•ClearwayLaw•19m ago•0 comments

Vitalik Buterin 2024: How to hard-fork to save most funds in a quantum emergency

https://ethresear.ch/t/how-to-hard-fork-to-save-most-users-funds-in-a-quantum-emergency/18901
3•olaird25•21m ago•0 comments

My Frontier, Not Yours

https://sutro.sh/blog/my-frontier-not-yours
5•sethkim•21m ago•0 comments

Xbox CLI

https://github.com/xbox/cli
3•plurby•23m ago•0 comments

Critical 21-year-old Linux flaw lets hackers bypass firewall rules

https://www.bleepingcomputer.com/news/security/critical-21-year-old-linux-flaw-lets-hackers-bypas...
5•ectospheno•23m ago•0 comments

Show HN: KestrelLock – Offline, one-time-purchase Windows privacy utilities

https://kestrellock.com/
1•evergreentools•24m ago•0 comments

UK cyber-agency: undisclosed issue with current cryptography no immediate threat

https://www.theregister.com/security/2026/12/03/cto-at-uk-cyber-agency-there-is-an-undisclosed-is...
1•nephihaha•25m ago•0 comments

Pluggable Live Stream Analysis: Designing Red5's Extractor and Analyzer

https://www.red5.net/blog/pluggable-live-stream-analysis-extractor-analyzer/
1•mondainx•25m ago•0 comments

After Scarce Intelligence

https://advancedruntime.com
1•hahahacorn•26m ago•0 comments

Timeline of What Trump administration Officials Knew, and When They Knew It

https://www.justsecurity.org/166538/nvidia-chips-china-what-trump-admin-knew/
3•klaff•27m ago•1 comments

Is your website ready for post-quantum encryption?

https://ohdear.app/news-and-updates/is-your-website-ready-for-post-quantum-encryption
1•contentkraft•29m ago•1 comments

Benchmarking 12 open-source repos on GitHub Actions vs. our runners

https://github.com/Ground-box/benchmarks
1•kurtistryber•30m ago•0 comments

How we got to 1K users on higo.wtf with $0 ad spend in under a month

https://higo.wtf/
1•robinsponge17•31m ago•1 comments

ChatGPT Plus users are burning through their new usage limit fast

https://www.techradar.com/ai-platforms-assistants/im-already-down-25-percent-in-seven-minutes-cha...
4•billybuckwheat•31m ago•1 comments

Introducing Frontier for All – Open AI Foundation

https://openaifoundation.org/news/introducing-frontier-for-all
3•dvaplima•31m ago•0 comments

Open sourcing PG Proxy: How we proxy 4T queries a month

https://www.datadoghq.com/blog/open-source-pg-proxy/
3•makaimc•32m ago•0 comments