Considering your next question, you can try a checkout of one of the three stages for your submodule:
git checkout -1 -- submodule # common ancestor
git checkout -2 -- submodule # source
git checkout -3 -- submodule # destination or MERGE_HEAD
Once a gitlink of a submodule has been changed, don't forget a git submodule update
, to refresh its content.
The OP Amiramix refers to this quora answer, where Berk D. Demir, Production Engineer at Facebook, adds:
git checkout -1 file
...will checkout the file from the ancestor of two branches.
This is neither "ours" nor "theirs". It's the version of the file right before these two branches diverged. Quite handy.
As you can guess, parameter -2
is for the version from HEAD and -3
is version from MERGE_HEAD
accordingly.
Another way to reach these files through all other git commands is to use the symbolic-refs of commits.
git checkout MERGE_HEAD -- file
gives the same effect with --theirs
or -3
.
Another handy syntax when dealing with merge conflicts is the colon-stage-colon prefix to path. git show :3:file
will show the file (not the diff) from MERGE_HEAD
.
A tiny cheat sheet:
-1 == $(git merge-base HEAD MERGE_HEAD)
-2 == --ours == HEAD
-3 == --theirs == MERGE_HEAD