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

1•stigma77•19s ago

Show HN: Enola-A deterministic architecture graph for developers and AI agents

https://github.com/enola-labs/enola/tree/main
1•GertLH•19s ago•0 comments

Chipify – Open-source workflow automation for analog IC design

https://chipify.io/
1•santihofi•42s ago•0 comments

Width vs. Depth: Speculating on the Margin

https://blog.doubleword.ai/speculating-on-the-margin
1•somnial•1m ago•0 comments

Agent-Rigor: AI Coding Discipline and Testing Framework

https://github.com/MeherBhaskar/agent-rigor
1•michael-sumner•3m ago•0 comments

Lunatic: An Erlang-inspired runtime for WebAssembly

https://lunatic.solutions/
2•giancarlostoro•4m ago•0 comments

US Government says it got hacked – again

https://techcrunch.com/2026/07/02/us-government-says-it-got-hacked-again/
1•rbanffy•5m ago•0 comments

China's CXMT Is Set to Challenge DRAM Incumbents

https://newsletter.semianalysis.com/p/chinas-cxmt-is-set-to-challenge-dram
1•rbanffy•6m ago•0 comments

Fable via API and Me

1•lygten•7m ago•0 comments

Localize your App Store IAP and subscriptions in 175 countries with one clic

https://medium.com/apparence/localize-your-app-store-prices-automatically-with-parityappkit-ae3d4...
1•macfleid•9m ago•0 comments

OpenAI Proposes Giving US Govt. 5% Stake

https://www.bloomberg.com/news/articles/2026-07-02/openai-proposes-giving-the-us-government-a-5-s...
1•karma_daemon•9m ago•1 comments

Show HN: LoopFlow – plain-English loops that run coding agents until tests pass

https://loopflow.live
1•forgeapp•11m ago•0 comments

3D Printing a Brain (2021)

https://jonathanraines.github.io/projects/3d-printing-a-brain/
1•JonathanRaines•11m ago•1 comments

Show HN: Newsprint – A native RSS reader for macOS with Hacker News support

https://github.com/ata-sesli/newsprint
1•ata-sesli•11m ago•0 comments

Low-level Haskell: The cursed way to emulate inline assembly in Haskell/GHC, or

https://minoki.github.io/posts/2026-06-30-haskell-inline-asm.html
1•fanf2•11m ago•0 comments

FoundationDB's Flow – Bringing Actor-Based Concurrency to C++11

https://apple.github.io/foundationdb/flow.html
1•sourdecor•11m ago•0 comments

Ask HN: Who here has gotten a job offer from 'Ask HN: Who wants to be hired?'

3•fur-tea-laser•12m ago•2 comments

Qdf – a Go serializer you query the raw bytes of, smaller than protobuf

https://github.com/alex60217101990/qdf
1•alex602•13m ago•0 comments

The System as a Program: fusing the database and the programming language

https://www.cambra.dev/blog/the-system-as-a-program/
2•sortalongo•16m ago•1 comments

Tarski's influence on computer science [pdf]

https://math.stanford.edu/~feferman/papers/tarskiandcs.pdf
1•remywang•16m ago•0 comments

Optimizing an Algorithm That's Quadratic by Design

https://whatchord.earthmanmuons.com/articles/chord-ranking-performance.html
1•elasticdog•17m ago•0 comments

Anthropic is removing its covert code for catching Chinese competitors

https://www.theregister.com/ai-and-ml/2026/07/01/anthropic-is-removing-its-covert-code-for-catchi...
3•johnbarron•18m ago•0 comments

Understanding List Virtualization

https://jlopes.eu/blog/understanding-virtualization/
2•offeringofpie•18m ago•0 comments

The Mythos report for curl 2026-05-06 made public

https://gist.github.com/bagder/c9b83a19f30e82e41b11f6315465b17a
1•_____k•18m ago•0 comments

Good APIs Age Slowly

https://yusufaytas.com/good-apis-age-slowly
2•birdculture•19m ago•0 comments

What Is CSS Containment and How Can I Use It?

https://csswizardry.com/2026/04/what-is-css-containment-and-how-can-i-use-it/
1•eustoria•19m ago•0 comments

PCs Explorer – Know your worth

https://strivetobeearthsbestemployer.com
1•johnbarron•19m ago•0 comments

Every New JavaScript Feature Worth Knowing

https://blog.webdevsimplified.com/2026-06/new-javascript-features-es2026/
1•eustoria•20m ago•0 comments

How to Switch LLM Providers Without Downtime

https://konghq.com/blog/enterprise/how-to-switch-llm-providers-without-downtime
1•axandriamier•21m ago•0 comments

A Judicial Wake-Up Call on Government by AI

https://www.techpolicy.press/a-judicial-wakeup-call-on-government-by-ai/
2•cdrnsf•21m ago•0 comments