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

Squashing commits with git rebase -i may miscount commits in commit message

From
BTBrandon Tolsch <btolsch@gmail.com>
Date
Jan 6, 2017, 09:04 UTC
Message-ID
<CAMWRQeRaQQQcJ-R8eHc7f0KqZF2eEkYJOyTb9n7ds78pTqV-AA@mail.gmail.com>
git --version: 2.11.0

When using git rebase -i to squash a series of commits that includes more than 10 commits, the generated commit message you are given to edit counts the old messages incorrectly. It will say the total number of commits is (actual % 10) (if they were 0-based) and it will also count the commits as (actual % 10).

For example, 15, 25, 35, etc. commits: # This is a combination of 5 commits. # This is the 1st commit message: msg

# This is the commit message #2: ... ... # This is commit message #10: msg

# This is commit message #1: ...

# This is commit message #5: msg

While not a big issue, it did make me double check what I was doing when I saw "a combination of 10 commits" instead of 20 in the commit message.

-Brandon Tolsch
Next: Johannes Schindelin
Message 1 of 6 in “Squashing commits with git rebase -i may miscount commits in commit message”
  1. Brandon TolschJan 6, 2017
  2. Johannes SchindelinJan 6, 2017
  3. rebase--interactive: count squash commits above 10 correctlyJeff King, Jan 7, 2017
  4. Johannes SchindelinJan 7, 2017
  5. Jeff KingJan 7, 2017
  6. Junio C HamanoJan 8, 2017

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.