@@ -387,7 +387,6 @@ convert many commits to one commit. To do this, use the rebase command:
387
387
.. code-block :: bash
388
388
389
389
$ git rebase -i upstream/master
390
- $ git push --force origin BRANCH_NAME
391
390
392
391
After you type this command, an editor will popup showing a list of commits:
393
392
@@ -401,7 +400,29 @@ To squash all commits into the first one, remove the word ``pick`` before the
401
400
second and the last commits, and replace it by the word ``squash `` or just
402
401
``s ``. When you save, Git will start rebasing, and if successful, will ask
403
402
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
405
426
406
427
.. _ProGit : http://git-scm.com/book
407
428
.. _GitHub : https://github.com/signup/free
0 commit comments