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

366-byte C program emulator can run Linux and Doom – IOCCC29 winner

https://github.com/ioccc-src/winner/blob/master/2025/cable/prog.c
1•s-macke•6m ago•1 comments

Show HN: Kodiqa Agent

https://github.com/Kodiqa-Solutions/Kodiqa-agent
1•open_source_new•8m ago•0 comments

Total Engineering

https://vietthan.github.io/blog/2026/06/05/total-engineering/
2•vietthan•13m ago•0 comments

Sansar – In development Gaussian Splat rendering [video]

https://www.youtube.com/watch?v=m7fwbKn9jGk
1•ugjka•16m ago•0 comments

Americans Are Keeping Their Cars Longer Than Ever–and Remaking the Auto Industry

https://www.wsj.com/business/autos/americans-are-keeping-their-cars-longer-than-ever-and-remaking...
3•JumpCrisscross•17m ago•2 comments

Heaven knows I'm perplexed now

https://idlemachines.co.uk/essays/perplexed
1•smaddrellmander•17m ago•0 comments

The Honest Case for the Humanities

https://substack.com/@napinillos/p-199545151
3•dsubburam•19m ago•0 comments

A USB-connected speaker can infect a PC without ever being touched

https://arstechnica.com/security/2026/06/highly-reviewed-speaker-can-be-hacked-over-the-air-to-in...
3•leecoursey•20m ago•1 comments

Universal Memory Protocol – a shared format for agent memory

https://universalmemoryprotocol.io/
4•edihasaj•20m ago•0 comments

WindowSwap: Someone else's window view from anywhere in the world

https://www.window-swap.com/
1•davidbarker•22m ago•0 comments

New U.S. college grads now have higher unemployment than the average worker

https://www.randalolson.com/2026/06/04/recent-grad-unemployment-flip/
1•davidbarker•23m ago•0 comments

China has approved the first invasive brain-computer chip

https://www.technologyreview.com/2026/06/01/1138133/china-world-first-brain-chip/
2•davidbarker•24m ago•0 comments

OpenAI Unveils Lockdown Mode to Protect Sensitive Data from Prompt Injection

https://techcrunch.com/2026/06/06/openai-unveils-lockdown-mode-to-protect-sensitive-data-from-pro...
4•odig•26m ago•0 comments

Shadow Blister Effect

https://en.wikipedia.org/wiki/Shadow_blister_effect
2•thunderbong•26m ago•0 comments

Show HN: Typedframes – Pandas/polars column name checking at lint time

https://github.com/w-martin/typedframes
2•w-martin•27m ago•2 comments

I am giving up on VM Gaming

https://deployonfri.day/posts/i-am-giving-up-on-vm-gaming
1•BoKKeR11•27m ago•0 comments

The Case for Space Datacenters

https://newsletter.semianalysis.com/p/to-boldly-go-the-case-for-space-datacenters
4•davedx•28m ago•0 comments

Eating Out

https://www.futilitycloset.com/2026/06/06/eating-out/
2•speckx•28m ago•0 comments

Madagascar Hissing Cockroach

https://en.wikipedia.org/wiki/Madagascar_hissing_cockroach
3•davedx•29m ago•1 comments

Thermometry at the MK Scale, Revisited

http://nanoscale.blogspot.com/2026/06/thermometry-at-mk-scale-revisited.html
1•EvgeniyZh•33m ago•0 comments

Milky Way black hole's missing wind found after a half-century-long search

https://phys.org/news/2026-06-milky-black-hole-century.html
3•davedx•33m ago•0 comments

For Whom the Boys Troll

https://www.cnn.com/2026/06/06/us/groypers-young-men-trolls-nick-fuentes-cec
3•1659447091•34m ago•0 comments

Elfeed 4.0 (Emacs)

https://github.com/emacs-elfeed/elfeed/blob/main/NEWS.org
4•DASD•34m ago•1 comments

Computex 2026: Are We Heading for the Agentic PC Era Yet? – EE Times

https://www.eetimes.com/computex-2026-are-we-heading-for-the-agentic-pc-era-yet/
4•rbanffy•35m ago•0 comments

Some ancient microbes frozen with Ötzi the Iceman are still growing

https://arstechnica.com/science/2026/06/otzis-mummified-body-is-home-to-ancient-strains-of-yeast-...
2•speckx•38m ago•0 comments

Creative Sound Blaster Katana V2X hijackable over Bluetooth; vendor denies flaw

https://www.tomshardware.com/tech-industry/cyber-security/creatives-sound-blaster-katana-v2x-can-...
2•sbulaev•40m ago•0 comments

Australian cockroach kingpin caught with 100k illegal bugs in record bust

https://apnews.com/article/illegal-cockroaches-seized-australia-madagascar-hissing-dubia-e35889bf...
3•randycupertino•41m ago•0 comments

Learn from Your Mistakes: Tree-Like Self-Play for Secure Code LLMs

https://arxiv.org/abs/2606.03489
1•Extropy_•46m ago•0 comments

Made my first plugin – How I orchestrated 3 LLMs to ship a plugin in 2 hours

https://byacommonthread.com/blog/what-should-i-eat
1•kaydub•47m ago•1 comments

Huawei post-trained DeepSeek's 1.6T model on 1k Ascend 910C chips

https://www.tomshardware.com/tech-industry/artificial-intelligence/huawei-led-team-claims-it-post...
3•sbulaev•49m ago•0 comments