frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Git Commands That Cover 90% of a Developer's Daily Workflow

https://jsdev.space/15-git-commands/
29•javatuts•2mo ago

Comments

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

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

to:

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

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

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

Oh and maybe cherry-pick

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

A Emoji Reverse Polish Notation Calculator Written in COBOL

https://github.com/ghuntley/cobol-emoji-rpn-calculator
2•ghuntley•2m ago•0 comments

I Shipped a macOS App Built by Claude Code

https://www.indragie.com/blog/i-shipped-a-macos-app-built-entirely-by-claude-code
1•phirschybar•4m ago•0 comments

AI Birthday Letter Blew Me Away: Google is ushering in era of custom chatbots

https://www.theatlantic.com/technology/archive/2025/07/google-drive-personalized-chatbot/683436/
1•labrador•5m ago•0 comments

Ask HN: Advice for Starting a Hacker Space?

5•pkdpic•7m ago•2 comments

Mirage: First AI-Native UGC Game Engine Powered by Real-Time World Model

https://blog.dynamicslab.ai
4•zhitinghu•13m ago•2 comments

Zig language and toolchain packaged as a deb for Debian and Ubuntu amd64/ARM64

https://github.com/clayrisser/debian-zig
2•clayrisser•13m ago•1 comments

'It's too late': David Suzuki says the fight against climate change is lost

https://www.ipolitics.ca/2025/07/02/its-too-late-david-suzuki-says-the-fight-against-climate-change-is-lost/
6•dluan•17m ago•0 comments

What Happened to the Creator of Valve's Forgotten Game – Gunman Chronicles

https://www.pcgamer.com/games/fps/what-happened-to-the-creator-of-gunman-chronicles-valves-forgotten-fps-my-relationship-with-gabe-didnt-really-go-that-great/
3•LarsDu88•17m ago•1 comments

IBM Quantum Success- Charles Tibedo's 127 qubit q-circuit w 70k Gates/20k Depth

https://twitter.com/CTibedo/status/1941606958143811765
2•GeometryKernel•21m ago•0 comments

A new way to conquer deterministic SEC filings

https://edgaranalyzer.com
2•louieteed•25m ago•0 comments

Show HN: D++lang – A new systems programming language with Python-like syntax

https://angel250511.github.io/D-/
2•jarbcopilot•28m ago•1 comments

Serving 200M requests per day with a CGI-bin

https://simonwillison.net/2025/Jul/5/cgi-bin-performance/
3•mustache_kimono•28m ago•0 comments

Soham Parekh breaks silence on defrauding companies, says he was forced to do it

https://timesofindia.indiatimes.com/world/us/im-not-proud-soham-parekh-breaks-silence-on-defrauding-companies-says-he-was-forced-to-do-it/articleshow/122235662.cms
2•romanhn•35m ago•0 comments

Discovery of ancient Roman shoes leaves a big impression

https://www.vindolanda.com/news/magna-shoes
2•geox•37m ago•0 comments

Xi Jinping's two-week absence sparks speculation of power shift within CCP

https://www.cnbctv18.com/world/chinese-president-xi-jinpings-two-week-absence-sparks-speculation-of-power-shift-within-ccp-report-19629056.htm
4•ivape•44m ago•3 comments

Only two islands in the world have population of more than 100M people

https://twitter.com/koridentetsu/status/1692831722159890752
2•matsuu•46m ago•0 comments

Britain is already a hot country. It should act like it

https://www.economist.com/britain/2025/07/03/britain-is-already-a-hot-country-it-should-act-like-it
4•_dain_•54m ago•6 comments

Science has changed, have you? Change is good

https://mnky9800n.substack.com/p/science-has-changed-have-you
2•Bluestein•1h ago•0 comments

Why Polyworking Is The Future Of Work And How To Become A Polyworker

https://www.forbes.com/sites/williamarruda/2024/11/05/why-polyworking-is-the-future-of-work-and-how-to-become-a-polyworker/
4•Anon84•1h ago•1 comments

Vine-like Systems and Malleability

https://nothingisnttrivial.com/vines.html
2•networked•1h ago•0 comments

Show HN: I Asked ChatGPT to Rebuild My Canvas Radial Menu in SVG

https://github.com/victorqribeiro/radialMenuSVG
2•atum47•1h ago•0 comments

Show HN: Quotatious – A Wordle and hangman inspired game

https://www.quotatious.com/
3•jcusch•1h ago•0 comments

Microsoft Music Producer

https://www.youtube.com/watch?v=EdL6b8ZZRLc
3•natebc•1h ago•0 comments

School Discipline Makes a Comeback

https://www.wsj.com/opinion/school-discipline-states-texas-arkansas-washington-covid-trump-obama-eeceba4c
4•sandwichsphinx•1h ago•0 comments

Building Multi-Agent Systems (Part 2)

https://blog.sshh.io/p/building-multi-agent-systems-part
2•sshh12•1h ago•0 comments

Solving Wordle with uv's dependency resolver

https://mildbyte.xyz/blog/solving-wordle-with-uv-dependency-resolver/
3•mildbyte•1h ago•0 comments

How the Biosphere 2 experiment changed our understanding of the Earth

https://www.bbc.com/future/article/20250703-how-the-biosphere-2-experiment-changed-our-understanding-of-the-earth
4•breve•1h ago•0 comments

Think slow, think fast (2016)

http://datagenetics.com/blog/december32016/index.html
2•josephcsible•1h ago•0 comments

Wikipedia Sandbox

https://en.wikipedia.org/wiki/Wikipedia:Sandbox
3•esadek•1h ago•0 comments

The Dalai Lama says he hopes to live more than 130 years

https://apnews.com/article/india-dalai-lama-buddhism-birthday-130-98ea3c4c4db8454ea56a7a123ac425ec
2•geox•1h ago•1 comments