Git Cheat Sheet
Small cheat sheet of git commands I frequently use.
Cloning a repository
git clone <remote-url>
Revert changes in working copy
git checkout .
Revert changes in a single file
git checkout <file>
Revert all local commits
git reset
Remove untracked files and directories
git clean -fd
Show stash diff
git stash show -p <stash-id>
Clear all stashes
git stash clear
Show remotes
git remote -v
Switch branch
git checkout <branch>
Show local unpushed commits
git log origin/master..HEAD
Show local unpushed commit diff
git diff origin/master..HEAD
Undo commit
git reset HEAD~
Categories: Linux, Uncategorized