'Does Git not generate a merge conflict when moving/deleting a section of code that contains changes from another squash?
To trace back the events in chronological order:
- User 1: started working on a feature. He creates a branch off the main branch.
- User 1: Moved a list of entries from a parent class to child classes, deleting a section of code, but the branch requires additional significant refactoring. Squashing is delayed until the refactoring is complete.
- User 2: To add a much smaller feature, User 2 added an entry to a list (that was deleted in User 1's branch) and squashed it into the main branch.
- User 1: as part of best practices, merges the main branch into his dev branch (regular merge, not squashing). Does not receive an explicit merge conflict that the list he moved/deleted contained an additional entry, thus breaking User 2's new feature.
So my question is correct behavior on Git's part? That is possible to delete more code than previously intended, and not throw up a merge conflict?
Also, as additional information if it helps, we're using BitBucket Cloud.
Solution 1:[1]
To answer my own question:
I recreated the merge, and it did generate a merge conflict warning on that section of code. So ultimately the answer is user error.
To be fair to User 1, GitKraken made it tricky to see the additional entry in the merge conflict. See if you can spot it:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | awakenDeepBlue |

