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

Re: merging multiple commit into one?

From
JMjean-luc malet <jeanluc.malet@gmail.com>
Date
May 12, 2009, 15:59 UTC
Message-ID
<1de9d39c0905120859r67a04376g99092d3e8c1403a9@mail.gmail.com>
In-Reply-To
<200905120036.06965.jnareb@gmail.com>

hello seems that I don't use the right way.... I chechouted my lastest branch, then do a git rebase --interactive 9ce8f6940a50d87e4f6503ff237bd1b1ff560660 where 9ce8f6940a50d87e4f6503ff237bd1b1ff560660 is the commit I want to start... I modified the file and marked the commit I wanted to squash... and well it keep continue to find me conflicts.... even where there shall not be

so I said I have to start from the root and rebase my branch on it.... created a branch on root, checkout it, git rebase --interactive b52ea8c36188b05de246d5717781ab90710078d5 huh?! nothing to do... ok fine

so I tried to put branch just after the nodes I wanted to squash.... and git rebase --interactive thesha1rigthbeforewhatiwantedtosquash.... ah! here it works! huh?! well quite not! it replayed the range of commit fine, removed the squashed one... fine... but do created another independant branch... what I don't want I just want to remove a set inside the current tree so I'm not doing it right?

thanks JLM

On Tue, May 12, 2009 at 12:36 AM, Jakub Narebski <jnareb@gmail.com> wrote:
Show 49 quoted lines
> On Tue, 12 May 2009, MALET Jean-Luc wrote:
>> Jakub Narebski wrote:
>>> jean-luc malet <jeanluc.malet@gmail.com> writes:
>
>>>> I often commit "useless" code, for example before going into weekend
>>>> or for saving some state during a dev process
>>>> often thoses commit are simply useless and the commit message looks
>>>> like "COMPILE ERROR - temporary save .... "
>>>> at the end I have LOT of theses commits that are useless and I want to
>>>> save some space/time/tree complexity merge multiple sequential commits
>>>> (without branch) into one
>>>> is it possible?
>
>>>
>>> It is possible; one solution would be to use "git rebase --interactive"
>>> and its 'squash' command...
>
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>>>> according to my knowledge of git, removing the commit and rewriting
>>>> the last commit log so that it better reflect the modification will do
>>>> the job but I'm not sure git allow it...
>>>>
>>>
>>> ...but you can simply pick up where you saved snapshot by using "git
>>> commit --amend" (or doing soft or mixed reset to previous commit
>>> before comitting changes).
>>>
>>>
>> hi! thanks for your answers!
>> I didn't knew about --amend for commit, will certainly use it...
>> however it seems that I get missunderstood...
>> A-o-o-o-o-o-B-o-o-o-o-C
>>                       \-o-o-D-/
>> let say I have the above tree, o are temporary unbuildable commits, A B
>> C D are usable versions
>> I want as posteriory remove the o to get the following tree
>> A-B---C
>>      \-D/
>> in fact I just wanna clean a little my tree since I forgot to amend ;)
>> is this possible?
>> ok I know, the best is to prevent! not to cure! so I'll amend ;)
>
> As I wrote above, you can use interactive rebase to clean up history.
>
> --
> Jakub Narebski
> Poland
>
-- 
KISS! (Keep It Simple, Stupid!)
(garde le simple, imbécile!)
"mais qu'est-ce que tu m'as pondu comme usine à gaz? fait des choses
simples et qui marchent, espèce d'imbécile!"
-----------------------------
"Si vous pensez que vous êtes trop petit pour changer quoique ce soit,
essayez donc de dormir avec un moustique dans votre chambre." Betty
Reese
http://www.grainesdechangement.com/citations.htm
Previous: Jakub NarebskiNext: Heiko Voigt
Message 6 of 10 in “merging multiple commit into one?”
  1. jean-luc maletMay 11, 2009
  2. Andreas EricssonMay 11, 2009
  3. Jakub NarebskiMay 11, 2009
  4. MALET Jean-LucMay 11, 2009
  5. Jakub NarebskiMay 11, 2009
  6. jean-luc maletMay 12, 2009
  7. Heiko VoigtMay 11, 2009
  8. MALET Jean-LucMay 11, 2009
  9. Heiko VoigtMay 12, 2009
  10. Markus HeidelbergMay 12, 2009

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.