Merge a remote pull to the current branch
Add the following script to
~/.gitconfig
1
2[alias]
pr = "!f() { git fetch ${2:-upstream} pull/$1/head:pr/$1 && git checkout pr/$1; }; f"Use
git pr PULL_NUM
to download the pull, for example, usegit pr 577
to checkout pr 577 into a branch calledpr/577
Merge the above branch to the target branch, for example
git merge pr/577
Rebase
1 | git pull --rebase upstream master |
Change branch to master
1 | git branch -m old-name new-name |