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

Re: Merging commits together into a super-commit

From
Johannes Sixt <j.sixt@eudaptics.com>
Date
May 10, 2007, 11:40 UTC
Message-ID
<4643049C.3D5F30D8@eudaptics.com>
In-Reply-To
<1178794261.5806.98.camel@murta.transitives.com>
Alex Bennee wrote:
Show 21 quoted lines
> I really love the fact I can micro-commit changes when I'm developing.
> However at some point the combination of changes I have made can be
> considered a single body of work. This is especially true when you start
> doing things like re-basing on code that has moved around a lot. You
> don't want to be correcting a whole bunch of merge failures for every
> commit in your current tree.
> 
> So far the only was I can see to do this is a:
> 
> git-diff master..HEAD > my.patch
> 
> And then re-applying your patch in stages, manually doing the commits.
> 
> Am I missing something?
> 
> I'm thinking something like git-cherrypick taking multiple commits and
> create a new super commit on a new tree. i.e.:
> 
> git-cherrypick -m "Valgrind fixes" 12345.. 12678.. 565757..
> 
> Merging the existing commit comments would be nice too.
Here we go:
- cherry-pick them before commit
  $ git cherry-pick -n x
  $ git cherry-pick -n y
  $ git cherry-pick -n z
  $ git commit -m "$(for c in x y z; do git show --stat $c; done)" -e
- merge in a single commit
  $ git merge --squash foo
You didn't really think that git couldn't do that, did you? ;)
-- Hannes
Previous: Johannes SchindelinNext: Linus Torvalds
Message 5 of 35 in “Merging commits together into a super-commit”
  1. Alex BenneeMay 10, 2007
  2. Raimund BauerMay 10, 2007
  3. Alex BenneeMay 10, 2007
  4. Johannes SchindelinMay 10, 2007
  5. Johannes SixtMay 10, 2007
  6. Linus TorvaldsMay 10, 2007
  7. Carl WorthMay 10, 2007
  8. J. Bruce FieldsMay 10, 2007
  9. Carl WorthMay 10, 2007
  10. Petr BaudisMay 10, 2007
  11. Carl WorthMay 10, 2007
  12. Using StGIT for tweaking already-committed stuffPetr Baudis, May 10, 2007
  13. Carl WorthMay 10, 2007
  14. Integrate StGIT into Git? (Was: Re: Using StGIT for tweaking already-committed stuff)Jan Hudec, May 11, 2007
  15. Karl HasselströmMay 10, 2007
  16. Yann DirsonMay 11, 2007
  17. Karl HasselströmMay 11, 2007
  18. Yann DirsonMay 12, 2007
  19. Karl HasselströmMay 12, 2007
  20. Robin RosenbergMay 10, 2007
  21. Yann DirsonMay 12, 2007
  22. Jakub NarebskiMay 12, 2007
  23. Karl HasselströmMay 12, 2007
  24. Yann DirsonMay 12, 2007
  25. Karl HasselströmMay 12, 2007
  26. Junio C HamanoMay 12, 2007
  27. Karl HasselströmMay 13, 2007
  28. Yann DirsonMay 13, 2007
  29. Store branch description in the config fileKarl Hasselström, May 14, 2007
  30. J. Bruce FieldsMay 10, 2007
  31. Petr BaudisMay 10, 2007
  32. J. Bruce FieldsMay 10, 2007
  33. Transactions for git (and stgit) ?Yann Dirson, May 12, 2007
  34. Karl HasselströmMay 12, 2007
  35. Yann DirsonMay 12, 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.