When merging or rebasing two branches in git, and a file has been deleted in one but modified in the other, git gives a conflict. git status
shows the file as "deleted by us" or "deleted by them".
I've found plenty of questions talking about how to resolve the conflict, including:
- git - merge conflict when local is deleted but file exists in remote
- How do I fix a merge conflict due to removal of a file in a branch?
However, most of the answers assume you already know exactly what the conflict is, and just need to tell git to keep or delete the file.
How do you find out what changed in the version of the file that was not deleted? git
simply leaves the whole file in the working copy, and doesn't mark any changes.
For instance:
- on branch
develop
, user A changes filefoo.x
- on branch
feature
, user B refactors the code, deletes filefoo.x
because its functionality is now in other files - user B tries to merge
develop
intofeature
, and gets a conflict markeddeleted by us
- how does user B see what user A changed, to see if the changes are needed in the refactored code?