- Notifications
You must be signed in to change notification settings - Fork6.6k
Merging a Pull Request
Please read on how to do an interactive rebase:
git rebase -i
Some good references:https://help.github.com/articles/about-git-rebase/https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase-i
These instructions assume that your setup has a remote calledupstream-mergepointing to the angular-ui/bootstrap repository (with push priviledges) and aread-onlyupstream remote from retrieving upstream changes.
This is the recommended setup. However, the instructions will also work if yoursetup only has oneupstream remote. Just replace instances ofupstream-mergewithupstream.
First lets say you have a PR:https://github.com/angular-ui/bootstrap/pull/1234
- First, checkout master, make sure it's up-to-date, and create a branch called
pull/1234:
git checkout mastergit pull upstream mastergit checkout -b pull/1234
- Fetch and merge (pull) the PR's commits and merge locally.
git pull --no-edit upstream pull/1234/headNote the
--no-editoption is used to skip editing the merge commitmessage. The reason for this is that there'll be a rebase later to edit themessages anyway and this commit will be discarded during rebase.
- Rebase and edit the commits as desired.
git rebase -i master
There are a few things to note here. Mark issues and pull requests that arefixed or closed withFixes #<issue> orCloses #<issue>. A typical commitmessage looks like:
feat(modal): add option to disable animationsNote: Move backdropClass logic into compile function because otherwisemodifying classes in the compile function is broken when using an interpolatedclass attribute.Fixes #1007Closes #2725The format of the commit message, along with mentioning all the issuesclosed/fixed is important for the changelog script used to updateCHANGELOG.md .
- Checkout master and merge your newly rebased branch. Note that thisshouldn't create a merge commit as it's fast-forwarded.
git checkout mastergit merge pull/1234# alternatively: git merge -- Finally, push to upstream. If it's successful, you're done!Please notenever force push to master. It'll break other user's clones of the repository as well as TravisCI.If by this step, the push is rejected, you can either repeat the steps above, or follow the steps below in the next section.
git push upstream-merge master
- Reset your local master to upstream's master.
git fetch upstream mastergit checkout -B master upstream/master
- Rebase your pull request branch on top of your updated local master.
git checkout pull/1234git rebase master
- Continue on step 4 in the previous section.