From: Yang Zhang <yanghatespam@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Gavin Guo <tuffkidtt@gmail.com>, git@vger.kernel.org
Subject: Re: How to fix “Your branch and 'origin/master' have diverged” after editing a commit that came before a pull?
Date: Sun, 21 Nov 2010 10:51:51 -0800 [thread overview]
Message-ID: <AANLkTim6h17cd6LjCt8e8HBHGCdyCjw1yx7PVUsD7piJ@mail.gmail.com> (raw)
In-Reply-To: <20101121163001.GA29216@sigill.intra.peff.net>
On Sun, Nov 21, 2010 at 8:30 AM, Jeff King <peff@peff.net> 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/
next prev parent reply other threads:[~2010-11-21 18:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-20 0:36 How to fix “Your branch and 'origin/master' have diverged” after editing a commit that came before a pull? Yang Zhang
2010-11-20 1:59 ` Yang Zhang
2010-11-20 4:36 ` Jeff King
2010-11-20 20:12 ` Yang Zhang
2010-11-21 14:45 ` Gavin Guo
2010-11-21 16:30 ` Jeff King
2010-11-21 18:51 ` Yang Zhang [this message]
2010-11-22 5:38 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTim6h17cd6LjCt8e8HBHGCdyCjw1yx7PVUsD7piJ@mail.gmail.com \
--to=yanghatespam@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=tuffkidtt@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).