Pro Git. This review should be easy. 10 out of 10. Go buy it now. Read it... Oh, wait you can't buy it because its free. Jokes aside; read this book.


Some Useful Bits

  • Why should you keep commit messages less than 50 characters? git log --lineone will take two lines.
  • When you leave a file out of a commit and don't want to make a second commit that says "oops this should have been in the last commit" or "typo fix" git commit --amend
  • What does git reset actually do? Honestly I need more practice with that, but now I know that I don't know what it actually does and I should avoid using it with the exception of git reset HEAD -- filename which unstages the file from the index.
  • git rebase -i, Oh, this one is good. Work on your computer for a while, multiple commits, but now you want to squash/split/rename/reorganise them. Use git rebase -i to do all that. However, only do this on original commits you have made on your computer and have not pushed anywhere yet.

Application

It is a little bit hard to explain why you need git. Its not perfect either, like a hammer, you will hit your own thumb. I have lost an hour of work by a misuse of the previously mentioned git reset. After a commit, its relatively safe to experiment with your project. Even if you make commit(s) that turn out to be nothing, you can rebase the branch to an earlier commit. The commits that are no longer not apart of the parent linage are orphaned, but are still saved on your hard drive. You can find them with a git reflog. Commits that are not connected to a branch are not sent to a remote on push. Almost everything that has been committed is retrievable. Most of the time git can save you from losing work. Not to mention, enabling collaboration in a massive distributed style (see the linux kernel for an example).


Quality

Also, this book is a lovely piece to read. There are so many technical documents that all you learn after reading a dozen times is that you need to figure everything out yourself so you can write the documentation. I hope to appreciate this book and other works I find educational and a delight to read.