Create
create new repo git init
clone repo git clone /path/to/repo (local) or git clone username@host:/path/to/repo (remote)
config username & email for commit message git config –global user.name <first name last name>
git config config –global user.email <email>
   
Stage files
add change git add <filename>
add all git add * OR git add .
remove git remove <filename>
   
Commit
commit changes git commit -m “commit message”
list staged, unstaged and untracked files git status
display commit history git log
replace last commit combined with staged changes git commit –amend
undo commit git revert <commit_id>
create tag git tag <tag> <commit_id>
   
Branches
list  branches git branch
create branche git branch <branch_name>
merge branch into current branch git merge <branch_name>
view changes between two branches git diff <source_branch> <dest_branch>
   
Remote & Collaboration
create new connection to a remote repo git remote add <remote_name> <url>
check update available from remote git fetch <remote_name> <branch_name>
update current local branch git pull <remote_name>
push local branch to remote git push <remote_name> <branch_name>
   
Specific log command
limit number of commits list git log -<limit>
condense output git log –oneline
display full diff git log -p
display stats git log –stat
look by author git log –author=”<author>”
look for commit message git log –grep=”<commit_message>”
look for commit with specific file git log <filename>
other… –graph, –decorate
<since>..<until> (can be commit_id, branch_name)