Git is a free & open source, distributed versioncontrol system designed to handle everything from small to very large projectswith speed and efficiency.
Every Git clone is a full-fledged repository withcomplete history and full revision tracking capabilities, not dependent onnetwork access or a central server. Branching and merging are fast and easy todo.
http://git-scm.com/download
http://code.google.com/p/msysgit/downloads/list?can=3
The best way to get one is by using the git-clone command to download a copy of an existing repository:
git clone git://git.kernel.org/pub/scm/git/git.git
git checkout [branchname]
git pull
$ git add [dir] # include everything in [dir]
$ git add path/to/file
$ git rm path/to/file
$ git commit -m "xxx" [path/to/file | -a]
$ git status
$ git push
Merge:
$ git checkout $branch2 # To switch branch
$ git merge $branch1
$ git reset --hard HEAD … # To undo the changes,
$ git reset [commit-id] [path/to/file] # To reset a file back to an old commit
Merge conflicts:
> git pull ###failed to pull since merge conflicts
> git stash ###stash away your changes
> git pull ### this time, pull will succeedof course
> git stash pop ### yourchanges are stash back, then Auto merges will happen. And the conflict fileswill be updated by the auto merge, and got 2 persons' changes and marked withhighlights "<<<<", "=====",">>>>".
You must update the files which got conflicts. Files that got"<<<" "===" ">>>" cannot becommit or push.
# After your modification to conflicts, you can commit and push now.
> git commit -m "xxx" [file1] [file2] [file3]
> git push
$ git tag [tag]
$ git branch [branch]
$ git grep xxx
git reset --hard HEAD~1
git show --name-only $commit
git log --follow -p $file
git show [commit-id-7char]:[path-of-file]
git mv [dir1] [dir2]
git mv [file1] [file2]
git mv [dir1]/[file] [dir2]/[file]
Written bysmilings in GuangZhou,Apile 1th, 2012