Search code examples
git

Git Merge doesn't merge all files from other branch


So this is my situation.

My .gitignore is empty. I have the A branch from which I created a new branch B, 10 days ago. Today I want to merge the A branch into branch B to keep in sync. However, when I try to use the merge command I notice that there are files that are not included in the merge although they are different in A and B.

When i try to see the differences between my branches with the command git diff --name-status A, the files are included.

Is this a common issue? How can this be solved?


Solution

  • So after some troubleshooting I found the cause to the problem.

    I noticed in the visual representation of the last commit that a 3rd branch had been merged into my branch, when I did a git reset HEAD~ it undid the changes of my last commit and I saw in the sourcetree UI that there was a difference of 22 commits with the remote of my branch. I then started a new branch C from B, committed my unstaged changes and merged A back into C.