[Libreoffice] newish to git: howto recover from bad merge?

Takeshi Abe tabe at fixedpoint.jp
Fri Nov 19 02:53:48 PST 2010


Hi,

On Fri, 19 Nov 2010 03:11:51 -0500, Kevin Hunter <hunteke at earlham.edu> wrote:
> $ git commit
> # Not currently on any branch.
> nothing to commit (working directory clean)
>
> $ git rebase --continue
> Applying: EasyHack: RTL macro from createFromAscii
> No changes - did you forget to use 'git add'?
>
> When you have resolved this problem run "git rebase --continue".
> If you would prefer to skip this patch, instead run "git rebase --skip".
> To restore the original branch and stop rebasing run "git rebase --abort".
> -----
It would be helpful to retrospect what happened as follows.
Assume that you are on the master branch in the git directory like:

 A--*B* [master]

where both A and B are changesets in the history and *B* means B is HEAD.
Then you have committed a changeset as "Y" to master in order to make
a patch for that:

     *Y* [master]
     /
 A--B

which is all green so far. But the upstream introduced "C" which resembles
and thus ironically conflicts "Y".
Then running `git pull -r` can *not* result in

        *Y'* [master]
        /
 A--B--C [remotes/origin/master]

as you want, it fails merging after fetching and making a temporary branch:

       Y [master]
      /
 A--*B* [(no branch)]
      \
       C [remotes/origin/master]

So `git add` has no luck. You can check where you are by `git branch`,
if it looks like
$ git branch
* (no branch)
  master
then the above guess matters.

A workaround for the situation might be:
$ git reset --hard # nuke dirty status
$ git checkout master
$ git merge origin/master
$ vi bf_svx/source/items/svx_xmlcnitm.cxx # resolve the conflicts
$ git add bf_svx/source/items/svx_xmlcnitm.cxx # add resolved
$ git commit
HYH.

Cheers,
-- Takeshi Abe


More information about the LibreOffice mailing list