I am trying to pull rebase with auto merging strategy,
m-hissain-sk01:sc hissain$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 47 and 3 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
error: could not apply b5f4d22... Refactored existing source
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply b5f4d22... Refactored existing source
m-hissain-sk01:sc hissain$ git status
interactive rebase in progress; onto 2d4593d
Last command done (1 command done):
pick b5f4d22 Refactored existing source
Next commands to do (2 remaining commands):
pick 4298398 Implemented clean swift version
...
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add/rm <file>..." as appropriate to mark resolution)
added by us: MyProj.xcodeproj/project.xcworkspace/contents.xcworkspacedata
added by us: MyProj.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
added by us: MyProj/Configs/Assets.xcassets/AppIcon.appiconset/Contents.json
...
Expected conflicts will be automatically resolved with ours version. But after running the command, I still see unstashed codes waiting to be resolved manually.
Why didn't it work?
The beginning of the rebase is missing from your output, but I strongly suspect that there was a message of the form:
CONFLICT (add/add): ...
or:
CONFLICT (rename/delete): ...
in among the various other messages. While you specified -X ours
(according to the original question text at least):
git pull --rebase -X ours
-X ours
only resolves some conflicts automatically, not all conflicts. In particular, it does not resolve what I call high level conflicts, such as add/add or rename/delete conflicts.
What you must do at this point is either finish the merge operation and continue the rebase using git rebase --continue
, or abort the entire rebase operation using git rebase --abort
. Remember that git pull
merely runs two Git commands for you:
git fetch
, and thengit merge
or git rebase
with parameters determined by what was fetched in step 1.The git rebase
you invoked in step 2 is incomplete. (I looked for some SO answers on how to go about resolving such merges—I know they exist—and have not found any good ones to link yet.) Edit: here's one for add/add: Resolving a 'both added' merge conflict in git?