Friday, May 24, 2013

git

Note that:
- Git is hard. 
- You should read a book about git first before using it on a project. 
- You'll not get a good git gui because there will never be one. 
- You'll understand the reason for index when you understand interactive hunk staging.
- You'll get bit by git rebase. 
- You'll get discombobulated by git reset.
- I experienced infinite joy when I stumbled upon this before gitk. I hope you too.
git log --graph --decorate --all --oneline
- You'll be utterly befuddled by reading the repo graph despite gitk.
- You'll be in git zen when you eventually get the usefulness of this.
git rebase --onto
- You'll experience euphoria when you run git filter-branch and it works.
- You'll eventually realize that git is a superior VCS.


Books:
Version Control With Git 2e - Loeliger McCullough 2012 O'Reilly (454 pages)
Pro Git 1e - Scott Chacon 2009 Apress (238 pages)

Git Internals - Scott Chacon 2008 PeepCode (121 pages)
Git from the Bottom Up - John Wiegley 2009 (31 pages)

Git Internals has a chapter 'The Git Data Model' with neat diagrams and I think it explains the data model better than other books but the book itself is not worth $9 - $12 price.

Version Control With Git is a good beginner book. Pro Git is a good reference book. Pro Git's 'Distributed Git' chapter describes workflows that other books do not. Version Control With Git has good chapters on 'Advanced Manipulations' and 'Tips, Tricks, and Techniques'. Once comfortable, you want a reference book.


git commands: 
gist


Workflows:
The upper branches are more stable than the lower ones i.e. lower branches are merged into upper.

basic workflow:
master
feature branches

git workflow:
master
maint
next
pu
feature branches

A successful Git branching model workflow:
One important point is to not fast-forward branches by default when merging into upper branches.
master
hotfix
release
develop
feature branches

It ironic that git, a distributed VCS, is gaining popularity in this day and age. Here is to clean histories. Git: 1, Others: 0.

github/rmandvikar

1 comment: