Skip to content

Commit 30e5869

Browse files
committed
added information on squashing commits
1 parent 5d92960 commit 30e5869

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

contributing/code/patches.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,29 @@ with master, don't merge; and force the push to the origin:
242242
$ git rebase -f upstream/master
243243
$ git push -f origin BRANCH_NAME
244244
245+
Often, moderators will ask you to "squash" your commits. This means you will
246+
convert many commits to one commit. To do this, use the rebase command:
247+
248+
.. code-block:: bash
249+
250+
$ git rebase -i head~3
251+
$ git push -f origin BRANCH_NAME
252+
253+
The number 3 here must equal the amount of commits in your branch. After you
254+
type this command, an editor will popup showing a list of commits:
255+
256+
.. code-block:: text
257+
258+
pick 1a31be6 first commit
259+
pick 7fc64b4 second commit
260+
pick 7d33018 third commit
261+
262+
To squash all commits into the first one, remove the word "pick" before the
263+
second and the last commits, and replace it by the word "squash" or just "s".
264+
When you save, git will start rebasing, and if succesful, will ask you to edit
265+
the commit message, which by default is a listing of the commit messages of all
266+
the commits. When you finish, execute the push command.
267+
245268
.. note::
246269

247270
All patches you are going to submit must be released under the MIT

0 commit comments

Comments
 (0)