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

General Resolution: LLM Usage in Debian

https://www.debian.org/vote/2026/vote_002
3•ckastner•4m ago•0 comments

MouthPad is now available – control devices with your tongue [video]

https://www.youtube.com/watch?v=xReyIF5pwRo
1•Barbing•7m ago•1 comments

Lucky 13 Starship sends out satellites and stays intact

https://cosmiclog.com/2026/07/24/lucky-13-starship-sends-out-satellites-and-stays-intact/
2•ColinWright•10m ago•0 comments

When Notion Becomes Too Much and Obsidian Not Enough

https://rizz.dev/blog/guides/notion-versus-obsidian
1•rizzdev•12m ago•0 comments

Watching Go's new garbage collector move through the heap

https://theconsensus.dev/p/2026/07/19/observing-gos-garbage-collector-old-and-new.html
2•matheusmoreira•15m ago•0 comments

Escaping the Sandbox

https://netwars.pelicancrossing.net/2026/07/24/escaping-the-sandbox/
2•ColinWright•18m ago•0 comments

DOE Launching First Fault-Tolerant Quantum Computer Initiative

https://www.energy.gov/science/articles/energy-department-announces-initiative-create-and-deploy-...
1•donutloop•19m ago•0 comments

Why Sodaslim Is Becoming a Popular Healthy Beverage

https://finance.yahoo.com/healthcare/articles/sodaslim-releases-updated-2026-highlights-122400710...
1•marlonfoltz•19m ago•0 comments

MouthPad: A Tongue-Controlled Touchpad

https://www.augmental.tech/
2•ZaninAndrea•19m ago•0 comments

Secretary Wright Announces First AI "Genesis Mission" Projects

https://www.energy.gov/articles/secretary-energy-chris-wright-announces-first-genesis-mission-pro...
3•donutloop•20m ago•0 comments

At the altar of AI capex, Google is sacrificing the golden goose

https://twitter.com/i/status/2080229375773941871
1•Michelangelo11•21m ago•0 comments

How the Other Half Scams

https://netwars.pelicancrossing.net/2026/07/17/how-the-other-half-scams/
1•ColinWright•21m ago•0 comments

Show HN: Elizabeth Line Guide (London) – Live departures, timetables, fares

https://elizabethlineguide.com
1•ahallan•23m ago•0 comments

Pennsylvania roads are being coated in radioactive wastewater

https://theconversation.com/pennsylvania-roads-are-being-coated-in-radioactive-wastewater-heres-w...
1•geox•23m ago•0 comments

The Library and the Librarian: Why AI Needs Two Different Brains

https://www.innerkore.com/blog/library-and-librarian/
2•gagan2020•30m ago•0 comments

PostgreSQL Extension Catalog

https://pgext.cloud
1•theanonymousone•32m ago•0 comments

The Cretan Method

http://hintjens.com/blog:81
1•thunderbong•33m ago•0 comments

Show HN: BlazeRules – YAML rule engine for streaming data, 5M records/SEC

1•jspuri•33m ago•0 comments

TurboPrefill: 3.27× Prefill Speedup in Llama.cpp

https://devpost.com/software/turboprefill
1•trykhlieb•38m ago•1 comments

Man convicted of child sex crime by added _ char "Fus Ro Dah" Skyrim username

https://www.cbc.ca/news/canada/nova-scotia/how-a-single-underscore-led-to-an-innocent-halifax-man...
8•walrus01•38m ago•4 comments

Instella-Moe: An Open Mixture-of-Experts Language Model

https://rocm.blogs.amd.com/artificial-intelligence/instella-moe/README.html
2•ilreb•39m ago•0 comments

Prompt Caching

https://earendil.com/posts/prompt-caching/
1•lebek•49m ago•0 comments

The Psychopath Code – By Pieter Hintjens [pdf]

https://hintjens.wdfiles.com/local--files/books/psychopathcode.pdf
3•gurjeet•49m ago•0 comments

Ask HN: How would you harden AI changes to a 1M-line legacy SaaS before review?

1•thegreatkahuna•51m ago•0 comments

AP2 and A2A: two agents working together and getting paid (in tokens)

https://blog.owulveryck.info/2026/06/25/from-isolated-agents-to-agentic-mesh-orchestrating-sdlc-w...
1•owulveryck•53m ago•0 comments

Substack adds AI text detection to all notes and posts

https://post.substack.com/p/against-claudefishing
2•meander_water•1h ago•0 comments

Could dark energy come from the Standard Model? ρ_Λ = ρ_P · e^(-90π)

https://zenodo.org/records/21515348
1•kisnorbert•1h ago•0 comments

The quest to keep organs alive outside the body

https://www.technologyreview.com/2026/07/24/1140790/the-quest-to-keep-organs-alive-outside-the-body/
1•joozio•1h ago•0 comments

Markup Language Zoo

https://brett.coulstock.id.au/markup-language-zoo.html
2•MrVandemar•1h ago•0 comments

Android May Soon Restrict On-Device ADB

https://kitsumed.github.io/blog/posts/android-may-soon-restrict-on-device-adb/
55•shscs911•1h ago•19 comments