Re: merging multiple commit into one?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 12 May 2009, MALET Jean-Luc wrote:
> Jakub Narebski wrote:
>> jean-luc malet <jeanluc.malet@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]