Scott Chacon, Ben Straub
Format: PDF / Kindle (mobi) / ePub
Pro Git (Second Edition) is your fully-updated guide to Git and its usage in the modern world. Git has come a long way since it was first developed by Linus Torvalds for Linux kernel development. It has taken the open source world by storm since its inception in 2005, and this book teaches you how to use it like a pro.
Effective and well-implemented version control is a necessity for successful web projects, whether large or small. With this book you’ll learn how to master the world of distributed version workflow, use the distributed features of Git to the full, and extend Git to meet your every need.
Written by Git pros Scott Chacon and Ben Straub, Pro Git (Second Edition) builds on the hugely successful first edition, and is now fully updated for Git version 2.0, as well as including an indispensable chapter on GitHub. It’s the best book for all your Git needs.
What you’ll learn
• Effectively use Git, either as a programmer or a project leader
• Become a fluent Git user
• Master branching, using Git on the server, and on other systems
• Integrate Git in your development workflow
• Migrate programming projects from other SCMs to Git
• Extend Git for your personal project needs
• Effectively use GitHub
Who this book is for
This book is for all open source developers: you are bound to encounter Git somewhere in the course of your working life. Proprietary software developers will appreciate Git’s enormous scalability, since it is used for the Linux project, which comprises thousands of developers and testers.
Table of Contents
1. Getting Started
2. Git Basics
3. Git Branching
4. Git on the Server
5. Distributed Git
7. Git Tools
8. Customizing Git
9. Git and Other Systems
10. Git Internals
work out of the box with no other arguments. However, you can set up other tracking branches if you wish — ones that don’t track branches on origin and don’t track the master branch. The simple case is the example you just saw, running git checkout -b [branch] [remotename]/[branch]. If you have Git version 1.6.2 or later, you can also use the --track shorthand: $ git checkout --track origin/serverfix Branch serverfix set up to track remote branch refs/remotes/origin/serverfix. Switched to a
account that has SSH console access to the gitolite account via authorized_keys), type: $ git clone gitolite:gitolite-admin $ git clone gitolite:testing To clone these same repos from any other account: $ git clone gitolite@servername:gitolite-admin $ git clone gitolite@servername:testing Customising the Install While the default, quick, install works for most people, there are some ways to customise the install if you need to. If you omit the -q argument, you get a “verbose” mode
install – detailed information on what the install is doing at each step. The verbose mode also allows you to change certain server-side parameters, such as the location of the actual repositories, by editing an “rc” file that the server uses. This “rc” file is liberally commented so you should be able to make any changes you need quite easily, save it, and continue. This file also contains various settings that you can change to enable or disable some of gitolite’s advanced features. Config
the patch) of the e-mail. For example, if this patch was applied from the mbox example I just showed, the commit generated would look something like this: $ git log --pretty=fuller -1 commit 6c5e70b984a60b3cecd395edd5b48a7575bf58e0 Author: Jessica Smith
fast-forward-only pushes, and allows only certain users to modify certain subdirectories in a project. You’ll build client scripts that help the developer know if their push will be rejected and server scripts that actually enforce the policies. I used Ruby to write these, both because it’s my preferred scripting language and because I feel it’s the most pseudocode-looking of the scripting languages; thus you should be able to roughly follow the code even if you don’t use Ruby. However, any