HEAD^
- First parent commit
HEAD~x
- xth parent commit
git reset HEAD -- file
- Unstage file
git checkout -- file
- Revert local changes (checkout file from the current branch)
git checkout branch -- file
- Get a file from other branch
git format-patch -1 <SHA>
- Make a patch file
git am <file>
- Apply a patch file
git checkout-index -a -f --prefix=<destination e.g. /var/www>
- Export sources to other folder from local repo (not bare)
git archive --format=tar --remote=ssh://:/<repo_path> master | tar -xf -
- Export sources to the current folder (e.g. /var/www/myapp) from remote repo