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

Re: Volume of commits

From
Karl Hasselström <kha@treskal.com>
Date
Jul 12, 2007, 14:03 UTC
Message-ID
<20070712140304.GB28310@diana.vm.bytemark.co.uk>
In-Reply-To
<m3ps2xu5hc.fsf@pc7.dolda2000.com>
On 2007-07-12 15:16:47 +0200, Fredrik Tolf wrote:
> Or do you somehow aggregate the smaller commits into larger patches
> and recommit them? Or is there some third possibility that I'm
> missing?

Aggregating commits and recommitting is easy, so that's a common tool, I'd say. But it's equally possible to take a large commit and pick it apart, for example by editing the patch by hand and reapplying it, or by using the hunk selection feature of git-gui.

For example, if you have just committed several changes as one big commit, you can do

  $ git reset HEAD^

to undo the commit but retain the changes in your working tree, and then use git-gui to select a subset of the changes and commit them, then select another subset and commit that, and so on.

If you need to edit a commit that isn't HEAD, you can use git-reset to go back to the commit you want to edit, do the editing, and then use git-rebase to reapply the other commits on top of the changed commit.

In general, there are a thousand ways to use git to rewrite history, either "by hand" or by using tools such as StGIT. (StGIT is what I personally use most of the time. I find it a good tool for producing readable patch series.)

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Previous: Karl HasselströmNext: Fredrik Tolf
Message 9 of 14 in “Volume of commits”
  1. Fredrik TolfJul 12, 2007
  2. VMiklosJul 12, 2007
  3. Johannes SchindelinJul 12, 2007
  4. Sven VerdoolaegeJul 13, 2007
  5. Alex RiesenJul 13, 2007
  6. rebase -i: call editor just once for a multi-squashJohannes Schindelin, Jul 21, 2007
  7. Johannes SchindelinJul 21, 2007
  8. Karl HasselströmJul 12, 2007
  9. Karl HasselströmJul 12, 2007
  10. Fredrik TolfJul 12, 2007
  11. Joshua N PritikinJul 12, 2007
  12. Karl HasselströmJul 12, 2007
  13. Linus TorvaldsJul 12, 2007
  14. Jakub NarebskiJul 13, 2007

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.