Skip to content

Commit 7d279e3

Browse files
OskarStarkwouterj
authored andcommitted
added examples for squashing
1 parent 68db46c commit 7d279e3

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

contributing/code/patches.rst

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ convert many commits to one commit. To do this, use the rebase command:
387387
.. code-block:: bash
388388
389389
$ git rebase -i upstream/master
390-
$ git push --force origin BRANCH_NAME
391390
392391
After you type this command, an editor will popup showing a list of commits:
393392

@@ -401,7 +400,29 @@ To squash all commits into the first one, remove the word ``pick`` before the
401400
second and the last commits, and replace it by the word ``squash`` or just
402401
``s``. When you save, Git will start rebasing, and if successful, will ask
403402
you to edit the commit message, which by default is a listing of the commit
404-
messages of all the commits. When you are finished, execute the push command.
403+
messages of all the commits.
404+
405+
Examples for "squashing" the first and the second commit into one commit:
406+
407+
.. code-block:: text
408+
409+
squash 1a31be6 first commit
410+
squash 7fc64b4 second commit
411+
pick 7d33018 third commit
412+
413+
or
414+
415+
.. code-block:: text
416+
417+
s 1a31be6 first commit
418+
s 7fc64b4 second commit
419+
pick 7d33018 third commit
420+
421+
When you are finished, execute the following push command:
422+
423+
.. code-block:: bash
424+
425+
$ git push --force origin BRANCH_NAME
405426
406427
.. _ProGit: http://git-scm.com/book
407428
.. _GitHub: https://github.com/signup/free

0 commit comments

Comments
 (0)