Reputation: 10161
Let's say i have branch B1 and B2, in B1 i have a file named myfile.txt and I modified it, in B2 I removed that file, now I want to merge B1 into B1, obviously git shows me that there is a merge conflict, as branch was deleted locally. Now I understand that changes in myfile.txt that were introduced in B1 should indeed be kept, but they should be moved somewhere to anotherfile.txt.
So my question is, how should I do merge in this case? Two possible scenarios come to my mind:
a) 1. Accept local changes and delete file 2. Commit merge 3. Create additional commit after merge where I move changes.
b) 1. Accept local changes and delete file 2. Change anotherfile.txt 3. Commit merge
So what solution is preferrable? Also, in solution b) is it even possible to do so? I mean, is it possible to introduce changes in not affected files during the merge and then commit that merge?
Upvotes: 0
Views: 39
Reputation: 5358
You can change any file in a merge commit so solution 2 of moving the text in the commit is fine.
Upvotes: 1