Git

https://git-scm.com/cheat-sheet

Workflow

git config –global user.name “”, git config user.name “Project Name”
git config –global user.email “you@example.com”
git init ., git clone <url> Initialize git in current folder or clone from url
git remote add <remote>
git add -A, git add ., git add <file>
git reset <> unstage, opposite of add
git commit -m 'message' commit staged changes
git commit -am 'message' commit all unstaged changes
git pull [origin] [branch]
git push <origin> <branch>
.gitignore
file_to_ignore
folder_to_ignore/
 
*.tmp      
my?ile.txt
log[0-9].txt
!important.tmp #negate
git reset –hard Remove staged and unstaged changes
git reset HEAD^ Undo most recent commit
git reset –hard <commit> Go back to specific commit
git clean Delete untracked files (temporary files and leftovers)
git diff Show difference between current and head
git diff HEAD Diff staged and unstaged changes
git diff –staged Diff staged changes
git restore <file> Delete unstaged changes to one file

Branch and merge

git checkout -b <name> create branch
git checkout <name> switch branch
git branch list branches
git merge <name> merge current branch with <name>
git mergetool run merge tool to fix merge errors
git branch -d <name>, -D delete / force delete branch
git config –global merge.tool p4merge Define merge tool