Git Cheat Sheet

Shutdown -r -t 0 (-r = reset; 0 is time to wait)
git log
git log --oneline --decorate --graph
git log [branch_from_name/parent_branch_name]
git -scm.com/docs ?
git branch
git branch -d [branch_name_to_delete]
git branch -a (-a for all (shows remote))
git branch -r (view remote branches)
git remote -v ?
get remote show origin
git remote set-branches --add
git origin [branch_name_to_add]
git rm [-n] -f -r *.* ? (params meaning?)
git clone [repo_to_clone]
git status -s (-s short form)
git checkout --track origin/daves_branch (clone remote branch)
git checkout -b [branch_name_to_checkout]
git checkout -d -f [branch_name_to_delete]
git checkout -f [branch_name_to_checkout]
git checkout [sha] (sha = head)
git checkout -b [new_branch] [sha]
git checkout -b [new_branch] HEAD~4 - where 4 = # of commits from the head
git checkout --track origin/[remote_branch] (checkout remote branch)
git branch -f [new_branch_name] [sha]
git reset --hard ??
git reset HEAD [filename] ?? (remove staged file)
git checkout [branch_name_to_checkout]
git add [file_name]
git add . (adds ALL)
git push
git push [remote_name] [branch_name]
git push --set-upstream origin [branch_name]
git push -u origin [branch_name]
git pull origin master
git mergetool
---------------------------------------
| Type 1 = Staged Tracked Files       |
| Type 2 = Unstaged Tracked Files     |
| Type 3 = Unstaged Untracked Files   |
---------------------------------------
git checkout . = removes only Type 2
git clean -f = removes only Type 3
git reset --hard = removes Type 1 & Type 2
git stash -u = removes Type 1, Type 2, & Type 3
git stash pop = removes Type 1, Type 2, & Type 3
git stash apply - https://git-scm.com/book/en/v1/Git-Tools-Stashing
---------------------------------------
| K-Diff                              |
---------------------------------------
C:\Program Files\KDiff3

git config --global --add merge.tool kdiff3
git config --global --add mergetool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe"
git config --global --add mergetool.kdiff3.trustExitCode false

git rm --cached 

git rm -r --cached .
git reset HEAD --hard
git status

Leave a comment

Your email address will not be published. Required fields are marked *