Rebase a pull request
There is nothing more daunting than rebasing your first pull request. I still
remember the day I was asked to do this and, honestly, I can't recall how I
pulled it off, but I did... of course this was years ago when there was no
Update branch button in
Github (which by the way, does a merge commit
which I personally dislike). So I'm gonna save you some time and a lot of
trouble with this mini guide.
- Clone the repository (if you don't have it already).
git clone https://github.com/<user>/<repository> i.e git clone https://github.com/weirdpattern/eslint-plugin-typescript
- Add the remote repository (if you don't have it already).
git remote add <remote> https://github.com/<other_user>/<remote_repository> i.e. git remote add upstream https://github.com/bradzacher/eslint-plugin-typescript
- Checkout the branch you want to rebase.
git checkout <branch_to_rebase> i.e. git checkout camelcase-rule
- Fetch the latest from the remote branch.
git fetch <remote> <branch> i.e. git fetch upstream master
- Rebase the remote branch onto your current branch.
git rebase <remote>/<branch> i.e. git rebase upstream/master
- Resolve any conflicts (if any)
git add . git rebase --continue
- Force a push (this is important, otherwise is mess up the entire history).
git push -f
That's it... this wasn't so bad, was it?