Re: How to fix “Your branch and 'origin/master' have diverged” after editing a commit that came before a pull?

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

 



On Sun, Nov 21, 2010 at 8:30 AM, Jeff King <peff@xxxxxxxx> wrote:
> On Sun, Nov 21, 2010 at 10:45:13PM +0800, Gavin Guo wrote:
>
>> > To fix it, what you want to do is recreate the history on top of B' as
>> > it happened on top of B. So first you go back to C', the last commit
>> > just before the commits from upstream that were rewritten. (you will
>> > have pick its sha1 out of the log):
>> >
>> >  git checkout -b temp B'
>>
>> I think you mean git checkout -b temp C'
>
> Yes, sorry. You should base your temp branch on C'.
>
>> >  git rebase --onto temp F'^ branch_name
>> [...]
>> > At that point your original branch should be in the state you want. You
>> > can delete the temp branch with "git branch -D temp".
>>
>> I'm sorry that I can't understand "your original branch should be in
>> the state you want" ?
>> You only create a temp branch, and rebase some commits on it, right ??
>> What does that related to original branch ??
>
> The three-argument form of rebase above will switch to branch_name (your
> original branch), consider F'^ as the upstream, and rebase
> F'^..branch_name on top of the commits in "temp".
>
> -Peff
>

Actually, I missed this detail earlier, and now like Gavin I'm
confused. *temp* is "in the state that you want," not original_branch,
right? temp shouldn't be deleted just yet; master should be updated to
point to this....
-- 
Yang Zhang
http://yz.mit.edu/
--
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]