Version Control with Git 2/e by Jon Loeliger, Matthew McCullough from O’Reilly Media
The book was provided as part of the blogger’s review program.
This book covers topics from basics to advanced aspects of git varying from basic daily usage to once in a life time commands that you dream have existed.
Who is the book for ?
If you want to
- know the modern day distributed version control systems
- stop using p4, a disaster happens when you wait for few seconds to open a file on the server across the continent
- learn about new data structures and concepts used in building an VCS
- be amazed about no central authority managing files and easily download thousands of revision changes in a single shot
- know how thousands of developers across the world contribute to thousands of projects without a central bottleneck
- did not know that creating a new branch is a millisecond operation
- stick with svn, but use the power of git
This book is for you if you fall under any of the options above
The book starts off with the origins on how Git started and the big guns, one of the biggest distributed open source software, The Linux Kernel, uses it.
The initial chapters deal with Basic Git concepts which provide you explanations of keywords which are used later on.
Chapter (5) deals with adding, removing and moving operations which is the most used operation during active development.
Chapter (6) deals with commits, the heart of
git version control and how its unique way it is what it is (the atomic changesets).
Chapter (7) provides a great in-depth explanation about branches and how you can create and experiment on branches w/o spoiling the existing tree and without even telling the server about the new changes. Here is where you will get to know that the creation of a branch is a millisecond operation rather than updating few table rows and locking them to avoid conflicts. Merging branches to keep or not keep history of the separate branch etc are explained in Chapter (9).
Looking back at what you or other authors have done is dealt in Chapter(8). Git can compare anything, commits, branches and tags (essentially any objects).
You slowly get into more advanced concepts of altering existing commits which I have personally dealt with in only one of my project for fixing my email address in a non-collaborated environment. Well modifying a commit has ‘disaster’ written all over it.
We get to see how git repositories are shared and what gets pushed when you initiate a push or pull. Git servers are explained as well to identify various forms you can send your code diff to the server so that it can be collaborated.
Did you know that you can share a directory on dropbox between collaborators and use it as a server as well ?
Patches are designed where you have a strict reviewer policy (like the Linux Kernel) to make a patch and send it across to be reviewed. Its added into the master once its added. This is also famously called ‘Pull Request’ on Github, where the team/community can discuss about the importance or requirement of the code change.
Hooks, the most underused by a developer but are more relevant to external services which use the code.
There are more interesting topics like
git filter-branchcovered which you will not get to use unless hell broke lose in your repository
- submodules – to reuse directories across multiple projects
Last, but not the least, an introduction to Github, which hosts hundreds of thousands open source repositories, is a nice addition though might look like its not necessary at first look. You can visually feel everything that you do on the command line on the UI. Many services like Continuous Integration for building & releasing software, verifying code quality, analysing code vulnerabilities etc were built on Github, essentially hook to the power of git helping developers complete the workflow.
Few of the stuff I personally learnt from the initial chapters
.gitdirectory makes more sense now
- I did not know about
git bisectand had to manually iterate through commits
- I got my hands dirty with
git filter-branch. Warning: Use with extreme caution.
- Home Page – http://git-scm.com/
- Wiki – http://en.wikipedia.org/wiki/Git_(software)
- Git Best Practices