Git has truly caused some stir in the life of developers world wide. Why, cause not only does it conceptually work completely different than the popularly known Subversion, but it is also used and endorsed by probably the largest open source project to day: Linux, in fact it was developed by Linus Benedict Torvalds, the godfather of the Linux kernel (here, go read up on the guy: Linus Torvalds)
There are a few simple needs when one approaches source control.
The Git Concept:
{Server Repo} <—A—> {Local Repo} <—B—> {Staging} <—C—>{Working} <—D—>{Stash}
| <—A—> | New {Local repo}:
git init [newrepofolder] New Branch git branch [newbranch] Merging another branch with current branch git merge [branchname] Cloning from a {Server repo}: git clone [-d branchname] [remote address:remoterepository OR http://remote:123/abc/abc.git] [/path/to/local/repository/] See Commit logs: git log Show {Local repo} commit details and diffs git show [--name-only] Show {Local repo} specific commit diffs git show [<-commit ID->] Sync {Local repo} to {Server repo}: git push Sync {Server Repo} to {Local repo}: git pull |
| <—B—> | Commit {Staging} to {Local Repo}:
git commit -m "[Commit Comment]" Revert {Staging} to {Working}: git reset HEAD [filename.1} Revert {Local Repo} to {Local Repo}(reverts the changes of the specified commit: git revert [<-commit ID->] |
| <—C—> | shows changes in {working} and {staged}:
git status [-s] Show differences between {working} and {staged}: git diff [--name-only] / -U[0-9##] Add Files to {staged}: git add [.] / [filename.1] [filename.2] Switch to another branch git checkout [branchname] Create and Switch {working} to another branch git checkout -b [branchname] Refresh {working} with {Local Repo} git checkout [-f] Show current {working} branch git branch |
| <—D—> | Stash the current changes in {working} to {Stash} and reverts to HEAD:
git stash Displays all the indexes in {Stash}: git stash list Apply an index from {Stash} to {working}: git stash apply @stash{[0-9##]}
|
These are the basics you will need to survive the the average git using development shop.

