git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Note the use of "rebase -i" to squash consecutive commits into one.

From
Eric Hanchrow <offby1@blarg.net>
Date
Aug 17, 2008, 22:32 UTC
Message-ID
<1219012340-23376-1-git-send-email-offby1@blarg.net>
---
 Documentation/git-rebase.txt |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 59c1b02..074f38b 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -341,7 +341,29 @@ was HEAD~4 becomes the new HEAD. To achieve that, you would call
 $ git rebase -i HEAD~5
 ----------------------
 
-And move the first patch to the end of the list.
+And move the first patch to the end of the list.  Similarly, you can
+squash a bunch of consecutive commits into one commit.  If you start
+with this:
+
+------------
+    Q---R---S---T---U master
+------------
+
+then the command
+
+----------------------
+$ git rebase -i HEAD~3
+----------------------
+
+would let you edit the last three commits -- S, T, and U; if you
+edit the lines corresponding to T and U by changing "pick" to
+"squash", the result will be
+
+------------
+    Q---R---S' master
+------------
+
+where S' contains all the changes that were in S, T, and U.
 
 You might want to preserve merges, if you have a history like this:
 
-- 
1.6.0.rc3.6.gf8030
Next: Junio C Hamano
Message 1 of 2 in “Note the use of "rebase -i" to squash consecutive commits into one.”
  1. Note the use of "rebase -i" to squash consecutive commits into one.Eric Hanchrow, Aug 17, 2008
  2. Junio C HamanoAug 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.