====== 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 '' | Initialize git in current folder or clone from url| | ''git remote add '' | | | ''git add -A'', ''git add .'', ''git add '' | | | ''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 '' | | | | | 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 '' | 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 '' | Delete unstaged changes to one file | | ==== Branch and merge ==== | ''git checkout -b '' | create branch | | ''git checkout '' | switch branch | | ''git branch'' | list branches | | ''git merge '' | merge current branch with | | ''git mergetool'' | run merge tool to fix merge errors | | ''git branch -d '', ''-D'' | delete / force delete branch | | ''git config --global merge.tool p4merge'' | Define merge tool |