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

Show HN: Wifui – A Terminal UI for Wi-Fi on Windows

https://github.com/sohamw03/wifui
1•sohamw03•18s ago•0 comments

Chinese open-source AIs are winning over a growing number of companies in the US

https://www.france24.com/en/live-news/20251222-as-us-battles-china-on-ai-some-companies-choose-ch...
1•giuliomagnifico•32s ago•0 comments

James Webb Space Telescope confirms first 'runaway' supermassive black hole

https://www.space.com/astronomy/black-holes/james-webb-space-telescope-confirms-1st-runaway-super...
1•benkan•1m ago•0 comments

Show HN: RustX – Python Ease, Rust Speed

https://github.com/GrandpaEJ/rustx-lang
1•ZOROX•1m ago•0 comments

Why US and Chinese satellites are 'dogfighting' in orbit

https://www.msn.com/en-us/news/world/why-us-and-chinese-satellites-are-dogfighting-in-orbit/ar-AA...
3•benkan•2m ago•0 comments

Media over QUIC: You Don't Need It

https://moq.dev/blog/you-dont-need-it/
1•kixelated•3m ago•0 comments

A Carbon-Rich Atmosphere on a Windy Pulsar Planet

https://iopscience.iop.org/article/10.3847/2041-8213/ae157c
1•defrost•5m ago•0 comments

How to (simply) host a production WordPress blog

https://docs.codecapsules.io/tutorials/how-to-simply-host-a-production-wordpress-blog
1•sixhobbits•5m ago•0 comments

AI is rewriting how power flows through the datacenter

https://www.theregister.com/2025/12/22/ai_power_datacenter/
1•defrost•10m ago•0 comments

A Python framework for building reliable software

https://zenodo.org/records/18016750
1•dohuyhoangvn93•11m ago•0 comments

Speed limits introduced on UK motorways (1956)

https://www.bbc.co.uk/news/videos/c62vvvk7zlxo
1•jjgreen•17m ago•0 comments

Backing Up Spotify

https://annas-archive.org/blog/backing-up-spotify.html
3•taubek•18m ago•0 comments

How to Use AI to Automate Repetitive Tasks Across Multiple Fields

https://sites.google.com/view/getafilenowcpa/accueil
1•SSStentacion•21m ago•0 comments

From Runtime Explosions to Compiler Checked Simplicity

https://paul-samuels.com/blog/2025/12/21/from-runtime-explosions-to-compiler-checked-simplicity/
1•ingve•22m ago•0 comments

I built two dozen single-file HTML tools that run offline and need no back end

4•ajtracysk•23m ago•3 comments

Show HN: Everything Is Free – An open source, CC0 electronic album

https://github.com/ichbinsoftware/everythingisfree
1•ichbinsoftware•23m ago•1 comments

A Cypherpunk's Manifesto

https://www.activism.net/cypherpunk/manifesto.html
2•avonmach•29m ago•0 comments

Can James Cameron make another blockbuster? Even he's not sure

https://www.cnn.com/2025/12/19/entertainment/video/james-cameron-avatar
1•benkan•31m ago•0 comments

CS Books I'll be reading in 2026

https://sushantdhiman.substack.com/p/cs-books-ill-be-reading-in-2026
1•x-sushant-x•31m ago•0 comments

Italian Competition Authority Fines Apple $115M for Abusing Dominant Position

https://en.agcm.it/en/media/press-releases/2025/12/A561
3•amarcheschi•39m ago•0 comments

Tachyon: High frequency statistical sampling profiler

https://docs.python.org/3.15/library/profiling.sampling.html
1•vismit2000•39m ago•0 comments

The Humanoid Redundancy Principle

1•aniijbod•39m ago•0 comments

Getting Started with Zebra AI – Zebra AI

https://zebra-ai.com/knowledge-base/getting-started-with-zebra-ai/
1•janandonly•44m ago•0 comments

The Mozilla I want focuses on people and not AI

https://andregarzia.com/2025/04/the-mozilla-i-want-focus-on-people-and-not-ai.html
3•Vinnl•44m ago•0 comments

University threatened with legal action after protest at academic's talk (UK)

https://www.bbc.co.uk/news/articles/cwyx3y84ln9o
1•mmarian•46m ago•0 comments

Nuno Loureiro, prof and dir of MITs Plasma Science and Fusion Center, dies at 47

https://news.mit.edu/2025/nuno-loureiro-professor-director-plasma-science-and-fusion-center-dies-...
2•gjvc•47m ago•0 comments

The Eye keeps your data simple clean and secure

https://eyebase.vercel.app/home
1•kira_aziz•47m ago•0 comments

Key Transparency for the Fediverse

https://soatok.blog/2025/12/15/announcing-key-transparency-fediverse/
3•walterbell•49m ago•0 comments

I love Kubernetes, I'm all-in on GitOps – but I hated diffs (until HelmEnvDelta)

https://medium.com/@balazs.csaba.diy/i-love-kubernetes-im-all-in-on-gitops-but-i-hated-env-to-env...
1•csababalazs•53m ago•0 comments

I Spent 3 Months Researching Image-Based Attacks

https://zero-trust-web.vercel.app/
3•Raviteja_•55m ago•1 comments