Search code examples
gitgit-merge

Git merge with data modified in one branch and nothing done in other branch


If we merge two branches such that in one branch I edit the whole file from start to end and in other branches, I do not change anything left the original content then what will be the final content of the file when I merge both branches?


Solution

  • The answer is probably it depends. It depends mostly on the shared parent of the 2 branches. And more things may get involved based on the merge strategy Git lands on.

    The most likely answer will be:

    • Git will check the common parent where the file is still present.
    • Git will see that the file was deleted after branch created.
    • Git will merge with the branches and leave the file deleted.