Re: how to squash two commits into only one

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

 



On Tue, Mar 29, 2011 at 2:15 PM, Tor Arntsen <tor@xxxxxxxxxxx> wrote:
> On Tue, Mar 29, 2011 at 07:42, Lynn Lin <lynn.xin.lin@xxxxxxxxx> wrote:
>> All,
>>   I have only have two commits in repo,then I want to squash these
>> two commit into one through git rebase -i .However it fails
>>
>> $ git rebase -i HEAD^1
>> it only show up one commit so can't squash (can't squash without a
>> previous commit)
>
> To squash commits with rebase -i:
> git log
> (identify the commit you wish to squash to)
> git rebase -i <the commit _before_ the one you want to squash to)
>
> e.g.
> git log
> 1
> 2
> 3
> 4
> ..
> you want to squash 2 into 3: Use git rebase -i 4
> (4 is really a hash of course).
>
> HEAD^some-value is OK sometimes but when I want to fix stuff down in
> the commit chain somewhere I find it simpler to use the hashes - just
> mark and paste.
> Anyway the real point is that with rebase -i you must specify the last
> commit _before_ the range you want to work with.

Thanks .However my case is like:
git log
1
2

I want to squash 1 to 2,what's the commit I should specify with rebase -i

> -Tor
>
--
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]