When a git merge conflict is resloved by keeping the current branch version, no files are listed when running git status
, because no files were changed.
Of course, if however the other branch version is selected to resolve the conflict, changes are listed.
Is there a way to see the files that took part in the merge conflict, after it was resolved (and before it's committed), regardless of changes?
Demonstration
The following is a pretty much full reproduction to get to what I'm talking about:
Say we have:
- A
master
branch, with a file namedt.txt
. - A
dev
branch that was branched out ofmaster
(sodev
also hast.txt
).
Now, let's create a conflict:
$ git checkout dev
$ echo test1 > t.txt
$ git commit -am "test1"
$ git checkout master
$ echo test12 > t.txt
$ git commit -am "test12"
$ git merge dev
The output of the last line is:
Auto-merging t.txt
CONFLICT (content): Merge conflict in t.txt
Automatic merge failed; fix conflicts and then commit the result.
Now, let's edit the file to resolve the conflict:
Before edit:
$ nano t.txt
<<<<<<< HEAD
test1
=======
test12
>>>>>>> dev
Let's resolve the conflict by deleting dev
s version in the editor. Hence, after edit:
$ cat t.txt
test1
And now:
$ git add .
$ git status
On branch master
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
However, if instead of resolving the conflict by keeping master
's version we would have went with dev
's version, like so:
$ cat t.txt
test12
...Then the changed files would have been listed:
$ git add .
$ git status
On branch master
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Changes to be committed:
modified: t.txt
So, going back to my question, I'd like to somehow list t.txt
in any case it was part of a resolved merge conflict. Can it be done?