Hacker News new | ask | show | jobs
by Doxin 2374 days ago
> check “git status” and read every line carefully.

Seconded, but I'd go even further. Run and read git status before and after running any git command until you get comfortable enough with git to where you can predict the output without running it.

Additionally you can go get git prompt[1] installed so you always know your git status at a glance. Saves a lot of typing in any case.

As a last suggestion I'd say go read git-scm.com[2]. It has the excellently written man pages for looking up what a command does and which flags it takes. It also has an amazingly written free ebook explaining git top-to-bottom. After reading that you'll be a git wizard compared to your peers.

[1] https://github.com/git/git/blob/master/contrib/completion/gi... [2] https://git-scm.com/

1 comments

I totally second reading the book front to back. It is not that long and fairly well written, and can save so much time and frustration in the long run. Giving the link is the first thing I do when helping someone with git.

Unfortunately so many people put that aside and never read it, and then come back to me a few weeks later because they messed everything up again, and still do not understand what I mean with "index".

Git is very powerful but a bit awkward, so I consider knowing the underlying concepts necessary to use it properly.

I don't even think git is all that awkward. It's incredibly elegant but that also makes it somewhat orthogonal compared to how you're used to think about stuff.

I dunno, git is probably one of the few instances where I feel like RTFM is a valid remark.