Skip to content

Commit 7cc57ad

Browse files
committed
Add instructions to rebase and push branch before merging
1 parent cfe3ac5 commit 7cc57ad

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

work/flow.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,22 @@ We **always use non-fast forward merges** so that the merge point is marked in G
474474

475475
.. code-block:: bash
476476
477+
# Prepare to merge
478+
git checkout master
479+
git pull # Sanity check; if master is up-to-date, skip ahead to "Merge" below
480+
git checkout tickets/DM-NNNN
481+
git rebase master
482+
git push --force # so that the commits on the remote branch match the commits merged*
483+
# Merge
477484
git checkout master
478-
git pull # Sanity check; rebase ticket if master was updated.
479485
git merge --no-ff tickets/DM-NNNN
480486
git push
481487
488+
We force push the rebased branch for three reasons:
489+
(1) In many repos, branch protection requires that Travis was run on any commits before they can be pushed onto master
490+
(2) The policy is to delete branches that have been merged. This is only possible if the exact commit has been merged.
491+
(3) For convenience, Github will automatically close pull requests if the corresponding branch has been merged to master.
492+
482493
**GitHub pull request pages also offer a 'big green button' for merging a branch to master**.
483494
We discourage you from using this button since there isn't a convenient way of knowing that the merged development history graph will be linear from GitHub's interface.
484495
Rebasing the ticket branch against ``master`` and doing the non-fast forward merging on the command line is the safest workflow.

0 commit comments

Comments
 (0)