logoalt Hacker News

etbebltoday at 2:52 PM4 repliesview on HN

I use "git add ." (or rather -A), but I will always do a "git status" first to make sure I'm not doing something silly. Of course you still have to be careful about subdirectories, which is why I usually also do a "git status" again before committing.


Replies

airstriketoday at 5:24 PM

even better, I recently learned I can just `gst` on oh-my-zsh for `git status` and other similar shortcuts

https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Content...

jamesharttoday at 4:18 PM

git add . is nondestructive and reversible. I tend to do git add . and then run git status.

I’m far more interested in confirming my mental model of what I am about to commit if I git commit right now than my mental model of what will be added if I git add right now.

If I didn’t already have that muscle memory I might try to switch to git add -v . which would tell me what files it added. I’d argue that a sane git would just output git status after a git add operation.

But also a sane git would have a more logical command than git rm —cached to unstage a file. Like git unstage perhaps.

eszedtoday at 3:35 PM

I'm with you, though I do it differently. I have a git-status plug-in in my editor that shows me what directories -> files have been changed, and then which lines when I open them. Scanning the sidebar is the same as running "git status" first, but I prefer the visual representation.

noir_lordtoday at 3:07 PM

another `git status` then `git add .` folk here, it's a quick sanity check and then quicker and frankly it's just the habit I got into when I first started using git.

I've never managed to get on with any UI for basic git tasks, they always end up been slower.

show 1 reply