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

Re: Git in a Nutshell guide

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 22, 2007, 14:24 UTC
Message-ID
<Pine.LNX.4.64.0711221522540.4725@wbgn129.biozentrum.uni-wuerzburg.de>
In-Reply-To
<1195737303.19260.27.camel@localhost>
Hi,
On Thu, 22 Nov 2007, Jonas Juselius wrote:
Show 19 quoted lines
> Suppose I have been working on some topic branch for a while and been 
> overly trigger happy, i.e. I have produced a ridiculous number of 
> commits along the way. At some point when I'm done I want to publish my 
> changes, but doing so would create an insanely obese history full of 
> near nonsense commits. What I want to do is to slim down the commit log 
> into pieces that actually makes sense. What is the preferred (or best, 
> most convenient) way of doing this? The way I have done this previously 
> is essentially:
> 
> 1.  git branch -m mytopic tmp_mytopic  # rename
> 2.  git branch mytopci tmp_mytpoic~42  # go back in history
> Loop:
> 3.1 git log; git diff; git annotate...
> 3.2 git diff tmp_mytopic~42..tmp_mytopic~33 | git-apply
> 3.3 git commit -m "sane commit message" -a
> 4.  git branch -d tmp_mytopic
> 
> If I need to reorder commits I can first use git-rebase -i to get
> everything streamlined. There must be a better way of doing this, right?

Yes, you can squash commits into previous commits with rebase -i. Just replace the second "pick" command (and if you want to squash more than two, the later commands, too) with "squash".

Hth, Dscho

Previous: Jonathan del StrotherNext: jhud7196@artax.karlin.mff.cuni.cz
Message 20 of 40 in “Git in a Nutshell guide”
  1. Jonas JuseliusNov 19, 2007
  2. Jakub NarebskiNov 19, 2007
  3. Jonas JuseliusNov 19, 2007
  4. David KågedalNov 22, 2007
  5. Jakub NarebskiNov 23, 2007
  6. Brian DowningNov 19, 2007
  7. Brian DowningNov 19, 2007
  8. Nicolas PitreNov 19, 2007
  9. Jakub NarebskiNov 19, 2007
  10. Jonas JuseliusNov 19, 2007
  11. Benoit SigoureNov 19, 2007
  12. Daniel BarkalowNov 19, 2007
  13. Jonas JuseliusNov 20, 2007
  14. Jakub NarebskiNov 20, 2007
  15. Jan HudecNov 21, 2007
  16. Jakub NarebskiNov 21, 2007
  17. jhud7196@artax.karlin.mff.cuni.czNov 22, 2007
  18. Jonas JuseliusNov 22, 2007
  19. Jonathan del StrotherNov 22, 2007
  20. Johannes SchindelinNov 22, 2007
  21. jhud7196@artax.karlin.mff.cuni.czNov 22, 2007
  22. Lars HjemliNov 19, 2007
  23. Jonas JuseliusNov 19, 2007
  24. Benoit SigoureNov 19, 2007
  25. Lars HjemliNov 19, 2007
  26. Benoit SigoureNov 19, 2007
  27. J. Bruce FieldsNov 19, 2007
  28. Matthieu MoyNov 19, 2007
  29. Doc fix for git-reflog: mention @{...} syntax, and <ref> in synopsys.Matthieu Moy, Nov 19, 2007
  30. Junio C HamanoNov 19, 2007
  31. Doc fix for git-reflog: mention @{...} syntax, and <ref> in synopsys.Matthieu Moy, Nov 19, 2007
  32. Matthieu MoyNov 19, 2007
  33. Benoit SigoureNov 19, 2007
  34. Matthieu MoyNov 19, 2007
  35. Benoit SigoureNov 19, 2007
  36. J. Bruce FieldsNov 19, 2007
  37. Junio C HamanoNov 19, 2007
  38. Matthieu MoyNov 19, 2007
  39. Junio C HamanoNov 19, 2007
  40. Matthieu MoyNov 19, 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.