I have special branch (release branch) which is an exact copy of master branch with some files and directories removed. No development is happening on this branch, however it must be in sync with master, so updates on master must be constantly pushed to that branch.
By doing a normal merge (git merge master
) I constantly get conflicts like (a sample README file for example):
CONFLICT (delete/modify): README deleted in HEAD and modified in master
which is expected: I try to merge changes in files, that I've deleted. So, to resolve them I jut use git rm README
.
To automate it, I though I could use automatic conflict resolution by specifying -X ours. Man pages suggest it is a right thing for me:
This option forces conflicting hunks to be auto-resolved cleanly by favoring our version. Changes from the other tree that do not conflict with our side are reflected to the merge result.
However, when I do git merge -s recursive -X ours master
I still get the same unresolved delete/modify conflicts. What am I doing wrong? Is there another way to automate conflict resolution?
Select Stage Changed Files To Commit (Ctrl-I) from Commit menu. Enter a commit comment like "deleted conflicting file" Commit (ctrl-enter) Now if you restart the merge it will (hopefully) work.
Copy the cell with the CONCATENATE formula (D2). Paste the copied value in the top-left cell of the range you want to merge (A2). To do this, right click the cell and select Paste Special > Values from the context menu. Select the cells that you want to join (A2 and B2) and click Merge and Center.
git checkout staging # go to staging branch git checkout dev . # this checkout dev file changes into staging git reset HEAD build # this remove added file in build folder git clean -f # this drops untracked files we just reseted git checkout -- .
There's probably a better way to do this, but I solved a similar problem by doing the merge (with the default merge strategy) and then running
git status | grep 'deleted by us' | awk '{print $4}' | xargs git rm
After this, you should resolve other conflicts as normal and then commit.
This just deletes all files that had been deleted on the current branch, which I think is what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With