Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git merge "deleted by us"

Tags:

git

merge

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?

like image 659
kris Avatar asked Jun 10 '15 02:06

kris


People also ask

What does deleted by us mean in git?

'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.

What does deleted by them mean?

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).

WHAT DOES added by us mean?

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.


1 Answers

Here is a partial solution:

  1. Resolve all non deleted merge conflicts by hand, which you have to do anyway

  2. 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

  3. Then do cat filesToRemove.txt | xargs git rm to remove all the files.

like image 172
Tim Biegeleisen Avatar answered Oct 04 '22 18:10

Tim Biegeleisen