git

undo merge that hasn't been pushed

git reset --merge HEAD~1

roll back hard

git reset --hard <commit/tag>

force push of a previous commit

git push -f origin <commit_id>:<branch>

delete remote branch

git push --delete origin <branch>

reset local branch after a forced-update (above)

git fetch
git reset origin/<branch> --hard

renaming branch and updating remote

git branch -m old-name new-name
git push origin --set-upstream new-name
git push origin :old-name

set username for single repo

git config user.username 'name'

set signing key for local repo

git config user.signingkey <id>

signing commits

git commit -S -m 'msg'

compare diff between two commits

git diff <commit>...<commit>

stash

git stash
git stash show

unstash

git stash pop

using hub

pull requests

hub pr list
hub pr checkout <num>

making a pull request

branching and rebasing

branching model

merging and rebasing