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

Comments

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

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

to:

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

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

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

Oh and maybe cherry-pick

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

I'm a Gilmore Girl! Why is smalltown American series beloved by women worldwide?

https://www.independent.ie/entertainment/television/im-a-gilmore-girl-why-is-series-set-in-sleepy...
1•TMWNN•2m ago•1 comments

Antic Bikes

https://www.youtube.com/watch?v=Ww-b_6Kj44Q
1•doener•3m ago•0 comments

Lonkero – Enterprise-Grade Web Security Vulnerability Scanner

https://github.com/bountyyfi/lonkero
1•velo2025•5m ago•0 comments

TMLR: Outcome-Based Reinforcement Learning to Predict the Future

https://openreview.net/pdf?id=bbhdeL8EUX
1•bturtel•6m ago•0 comments

A Complete Visual Tour of the First WordPress Release

https://iterativewonders.com/2025/12/04/a-complete-visual-tour-of-the-first-wordpress-release-ever/
1•Kerrick•7m ago•0 comments

Netflix agrees to buy Warner Bros Discovery studio in 83B deal

https://www.theguardian.com/business/2025/dec/05/netflix-frontrunner-warner-bros-discovery-stream...
1•tosh•7m ago•0 comments

Privacy People- a Documentary About Privacy and the Privacy Profession

https://www.youtube.com/watch?v=EqZOzwVaZp8
1•bteamfilms•9m ago•1 comments

An AI for an AI: Anthropic says AI agents require AI defense

https://www.theregister.com/2025/12/05/an_ai_for_an_ai/
2•speckx•12m ago•1 comments

The Data on Self-Driving Cars Is Clear. We Have to Change Course

https://www.nytimes.com/2025/12/02/opinion/self-driving-cars.html
1•fortran77•13m ago•2 comments

The Big Blind

https://avc.xyz/the-big-blind
1•wslh•13m ago•0 comments

Show HN: Notekit – A Privacy-First Note-Taking Extension for Chrome

https://chromewebstore.google.com/detail/notekit-smart-note-taking/odlainjhjhfffelembfofofpebneonfn
1•kamdev•17m ago•0 comments

The Surprisingly Complicated World of SMS: Emoji SMS Reactions

https://nickvsnetworking.com/the-surprisingly-complicated-world-of-sms-emoji-sms-reactions/
2•speckx•17m ago•0 comments

Emacs Is My New Window Manager

https://www.howardism.org/Technical/Emacs/new-window-manager.html
1•gpi•18m ago•0 comments

Simplicity of a Database, but the Speed of a Cache: OLAP Caches for DuckDB

https://motherduck.com/blog/duckdb-olap-caching/
1•articsputnik•19m ago•0 comments

Error Handling Patterns (2023)

https://andreabergia.com/blog/2023/05/error-handling-patterns/
2•Wingy•19m ago•0 comments

Show HN: Kronos – Type-safe trading framework in Go with terminal UI

https://github.com/backtesting-org/kronos
1•lkwtsn•21m ago•0 comments

Agent Client Protocol (ACP) Lands to JetBrains IDEs

https://blog.jetbrains.com/ai/2025/12/bring-your-own-ai-agent-to-jetbrains-ides/
2•ignatovs•21m ago•1 comments

Show HN: PastScreen – open-source macOS screenshot tool that grabs file paths

https://github.com/augiefra/PastScreen
1•augiefra•21m ago•1 comments

Search 11,000 amendments to the U.S. Constitution proposed between 1789 and 2022

https://amendmentsproject.org/about
1•keepamovin•22m ago•0 comments

Show HN: PGM-Extra – High-performance learned index structures for Rust

https://github.com/itsfoxstudio/pgm-extra-rs
1•rpunkfu•23m ago•0 comments

Show HN: Losselot – See if your FLACs are fibbing, catch encoding audio relics

https://github.com/notactuallytreyanastasio/losselot
1•rhgraysonii•24m ago•0 comments

When Product Markets Become Collective Traps: The Case of Social Media

https://www.aeaweb.org/articles?id=10.1257/aer.20231468
1•tomrod•25m ago•1 comments

Free Gemini Watermark Remover

https://geminiwatermark.online
2•ocmaker•26m ago•0 comments

Show HN: A tool to visualize and map dependency hell in legacy COBOL codebases

https://apps.microsoft.com/detail/9n1b6m4fz1c8?hl=en-US&gl=US
1•NabilChiheb•27m ago•0 comments

First English language slang dictionary (1698)

https://languagelog.ldc.upenn.edu/nll/?p=72066
1•bookofjoe•27m ago•0 comments

CSS Fizz Buzz

https://susam.net/css-fizz-buzz.html
1•blenderob•29m ago•0 comments

The "soft" racism of the well-meaning white liberal, myself included

https://ncte.org/blog/2017/12/soft-racism-well-meaning-white-liberal-included/
3•volemo•32m ago•3 comments

Rad: Modern CLI scripts made easy

https://github.com/amterp/rad
1•nateb2022•33m ago•0 comments

The lethal trifecta and how to defend against it

https://hiddenlayer.com/innovation-hub/the-lethal-trifecta-and-how-to-defend-against-it/
1•beabytes•35m ago•0 comments

Influential study on glyphosate safety retracted 25 years after publication

https://www.lemonde.fr/en/environment/article/2025/12/03/influential-study-on-glyphosate-safety-r...
6•isolli•35m ago•0 comments