commit to the wrong branch what to do
Bryan Murdock
bmurdock at gmail.com
Fri Sep 2 15:18:20 UTC 2016
On Fri, Sep 2, 2016 at 4:51 AM, Arne Babenhauserheide <arne_bab at web.de> wrote:
>
> Andreas Tscharner writes:
>
>> On 01.09.2016 11:16, Uwe Brauer wrote:
>>> Most likely this sometimes happens:
>>> I added, removed, edited and then commit, but alas to the wrong branch.
>>> What is the most efficient way to solve this issue?
>>
>> I would have taken
>> hg graft
>> and afterwards deleted/reverted the commit on the wrong branch
>>
>> hg help graft:
>> copy changes from other branches onto the current branch
>
> That’s what I recently did, too:
>
> $ hg update right_branch
> $ hg graft -r <REV>
> $ hg update wrong_branch
> $ hg backout -r <REV>
>
> and then to avoid having to do it again:
>
> $ hg update right_branch
This is the correct procedure if you have pushed the changeset that
you put on the wrong branch. If you haven't pushed it yet rebase is
easier and completely removes the mistake. Backout, as other
mentioned, is another option, but also only if you have not pushed
yet.
Bryan
More information about the Mercurial
mailing list