I have looked at similar stackoverflow questions, but none provided a working solution for me.
On the current project I am working on, we have a bunch of branches:
- master: features get pushed on there once they are proven to be stable
- X feature branches: each developer branches off of master, works on their feature, and pull requests it once done.
The problem is that we're currently undergoing huge refactoring of the code, meaning that regardless what feature someone is working on, it is likely that two or more people are touching the same method in the same file at the same time in a different branch.
Therefore, if another branch having worked on the same files I did pull requests before I do, my branch will now be behind the master branch.
Due to this, I pull from master into my branch to get the newest updates and resolve merge conflicts before continuing to work on my own feature/refactoring or pull requesting.
However, and here is the problem, git does not seem to show me all the merge conflicts that are actually there. To take a simple example, let's just assume that in my own branch I renamed a class A to NewA, and updated all references accordingly. Now me and person B are both touching a method Z, me mainly refactoring it, person Z just adding a few fixes to known problems. When merging, some conflicts, where the code is different, get shown - but it feels as if others don't, because all my NewA references have been reverted back to A, without git telling me about it.
For the record, when merging I do something like this:
commit&push all my changes to my branch
git pull origin master
Now, if it was just small changes like that that wouldn't even compile everything would be fine, but I'm assuming that if git does not warn me about overwriting these things, it won't warn me about overwriting other things either, and I therefore have no clue what I've lost.
TL;DR: Is there a way for stopping git from overwriting changes I made without telling me? (I'm aware I can force my changes to take priority, but I don't want to do that either. I need to review each change manually. And I can't cherry-pick commits either, as I need to always be working on a base version of master that is up-to-date.)
Edit: When I run both the master version of the file and the file from my branch through a random online diff tool, it CLEARLY shows me all the differences there are and doesn't just pretend to show some while actually overriding stuff. Why can't git just do the same with stuff that should clearly be overwritten by my version of the code, instead of overwriting it with the old version?
We usually don't have this problem since we're working on different features and files, but since I'm in the process of refactoring everything I can't avoid touching files other people are touching as well.