git checkout -- {file}
git checkout origin/{branch} -- file
git checkout {revision} {file}
git show {remote|branch}:{file}
git clone {remote}
git remote rename origin upstream
Create repository to push to, then:
git remote add origin {remote_repository_url}
git add .
git push -u origin master
git checkout tags/{tagNumber}
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
git branch -a (all branches, local and remote)
git branch -r (only remote branches)
git branch --merged master
git branch --no-merged master
git tag -l
git push -d origin <branch_name>
git branch -d <branch_name>
git branch -m {old_branch_name} {new_branch_name}
git diff {hash} HEAD {file}
git log --author="searchterm"
git push -f origin origin/{branch_name}:{branch_name}
git diff branch1 branch2
git diff branch1 branch2 -- filename
git stash clear
find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull" \;
git log --author="<name or email>"
git log --pickaxe-regex -p --color-words -S "<regexp to search for>"
git log --grep="<message>"
git stash show <stash_name>
git log --author="<name or email>" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -
git shortlog -s -n --all --no-merges