I am doing a big merge. A lot of files have been removed from the repo in my branch, and in doing the merge I want to keep this change for all of those files. There are also some files that will need explicit merging and I'm intending to use git mergetool
to merge them.
I wish to keep the "deleted by us" change (ie. the files should remain deleted) for all deleted files. Other merge conflicts I want to resolve myself.
Is there a way I can tell git to keep the deleted files deleted?
'deleted by us' means the file is deleted in the commit which you are trying to do a cherry-pick. It is not file is deleted by you. Git tells that the file was deleted in some other commit, and allows you to decide to retain it (git add) or to remove it.
Hence, files "deleted by us" are those that were deleted on the branch you are rebasing onto (the final branch), and files "deleted by them" are files that were deleted in the branch you are rebasing (the one that will be dropped).
The "added by us:" is telling you that "com/company/A. java" is new to your branch and was brought in by the branch you're rebasing against.
Here is a partial solution:
Resolve all non deleted merge conflicts by hand, which you have to do anyway
Type git diff --name-only --diff-filter=U
to get a list of all remaining files in conflict. These files must be the ones you want deleted. Save the list of removed files as filesToRemove.txt
Then do cat filesToRemove.txt | xargs git rm
to remove all the files.
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