Thursday, March 17, 2011

Git Handbook

Git is version control software that allows coders to tinker with their code without compromising the project's code. Here are the basics you'll need to git going with Git.

Git Configuration
Set your email that will appear in commit messages.
git config user.email youremail@example.com

Set your name that will appear in commit messages.
git config user.name 'FirstName LastName'

Recommended: Tells git-branch and git-checkout to setup new branches so that git-pull will appropriately merge from that remote branch. Without this, you will have to add --track to your branch command or manually merge remote tracking branches with "fetch" and then "merge".
git config branch.autosetupmerge true

You can add "--global" after "git config" to any of the above commands to make it
apply to all git repos (note this will edit the ~/.gitconfig).

Clone the specified repository by <repo> this is similar to "checkout" in some other version control systems such as Subversion and CVS

git clone <repo>

Gathering information from Git
git diff

Show files added to the index, files with changes, and untracked files
git status

Show recent commits, most recent on top
git log

Show the changeset (diff) of a commit specified by <rev>, which can be any SHA1 commit ID, branch name, or tag
git show <rev>

Show who authored each line in <file>
git blame <file> 

Show who authored each line in <file> as of <rev> (allows blame to go back in time)
git blame <file> <rev>

As usual,  you can expect more to come soon.
Online Marketing