Skip to content

Commit ff283a6

Browse files
committed
DOC: add squash section to contributing
1 parent 809024f commit ff283a6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc/source/contributing.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,9 @@ Now you can commit your changes in your local repository::
672672

673673
git commit -m
674674

675+
Combining commits
676+
-----------------
677+
675678
If you have multiple commits, it is common to want to combine them into one commit, often
676679
referred to as "squashing" or "rebasing". This is a common request by package maintainers
677680
when submitting a Pull Request as it maintains a more compact commit history. To rebase your commits::
@@ -681,6 +684,18 @@ when submitting a Pull Request as it maintains a more compact commit history. T
681684
Where # is the number of commits you want to combine. Then you can pick the relevant
682685
commit message and discard others.
683686

687+
To squash to the master branch do::
688+
689+
git rebase -i master
690+
691+
Use the ``s`` option on a commit to ``squash``, meaning to keep the commit messages,
692+
or ``f`` to ``fixup``, meaning to merge the commit messages.
693+
694+
Then you will need to push the branch (see below) forcefully to replace the current commits with the new ones::
695+
696+
git push origin shiny-new-feature -f
697+
698+
684699
Pushing your changes
685700
--------------------
686701

0 commit comments

Comments
 (0)