Skip to content

Commit

Permalink
Add instructions to rebase and push branch before merging
Browse files Browse the repository at this point in the history
  • Loading branch information
yalsayyad committed Oct 1, 2018
1 parent fb9c1a5 commit 5b3e972
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion work/flow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,22 @@ We **always use non-fast forward merges** so that the merge point is marked in G

.. code-block:: bash
# Prepare to merge
git checkout master
git pull # Sanity check; if master is up-to-date, skip ahead to "Merge" below
git checkout tickets/DM-NNNN
git rebase master
git push --force # so that the commits on the remote branch match the commits merged*
# Merge
git checkout master
git pull # Sanity check; rebase ticket if master was updated.
git merge --no-ff tickets/DM-NNNN
git push
We force push the rebased branch for three reasons:
(1) In many repos, branch protection requires that Travis was run on any commits before they can be pushed onto master
(2) The policy is to delete branches that have been merged. This is only possible if the exact commit has been merged.
(3) For convenience, Github will automatically close pull requests if the corresponding branch has been merged to master.

**GitHub pull request pages also offer a 'big green button' for merging a branch to master**.
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.
Rebasing the ticket branch against ``master`` and doing the non-fast forward merging on the command line is the safest workflow.
Expand Down

0 comments on commit 5b3e972

Please sign in to comment.