Skip to content

[git] Solving conflicts

Utumno edited this page Mar 2, 2014 · 3 revisions

I had to rebase on dev my branches - I knew it'd hurt:

MrD@MRSD /c/dropbox/eclipse_workspaces/python/wrye-bash (master)
$ git checkout utumno-refactoring_master
Switched to branch 'utumno-refactoring_master'

MrD@MRSD /c/dropbox/eclipse_workspaces/python/wrye-bash (utumno-refactoring_mast
er)
$ git rebase dev
First, rewinding head to replay your work on top of it...
Applying: Added gitignore, gitattributes.
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging .gitignore
CONFLICT (add/add): Merge conflict in .gitignore
Auto-merging .gitattributes
CONFLICT (add/add): Merge conflict in .gitattributes
Failed to merge in the changes.
Patch failed at 0001 Added gitignore, gitattributes.
The copy of the patch that failed is found in:
   c:/dropbox/eclipse_workspaces/python/wrye-bash/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

MrD@MRSD /c/dropbox/eclipse_workspaces/python/wrye-bash (utumno-refactoring_mast
er|REBASE 1/84)
$

Oops - however, the error message indicates it is the .git files - at once expected (cause indeed I had my versions in my branch) and not dangerous:

gitk branch

So:

$ git gui &

gitk branch

As you see I have selected the "Use Local Version" - in the case of rebase (and only then) local stands for the branch we are rebasing onto, in our case dev - since I want the dev changes to persist I choose "Use local version". Accept the :

---------------------------
Git Gui (wrye-bash)
---------------------------
Force resolution to this branch?
Note that the diff shows only conflicting changes.

.gitattributes will be overwritten.

This operation can be undone only by restarting the merge.
---------------------------
Yes   No
---------------------------

and :

gitk branch

As you see there are no differences - as the local version is what we kept. Issue:

MrD@MRSD /c/dropbox/eclipse_workspaces/python/wrye-bash (utumno-refactoring_mast
er|REBASE 1/84)
$ git rebase --continue
Applying: Added gitignore, gitattributes.
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

Yes of course, since I kept the version of dev I have nothing to commit - so:

MrD@MRSD /c/dropbox/eclipse_workspaces/python/wrye-bash (utumno-refactoring_mast
er|REBASE 1/84)
$ git rebase --skip
Applying: Pydevproject - this fixes some import errors and makes it portable - W
IP
# ...

Finally push (via the gui is the easiest).

Clone this wiki locally