Git - how to automatically resolve "deleted by us" conflict when cherry-picking

Legat picture Legat · Apr 10, 2017 · Viewed 7.5k times · Source

I run the following command:

git cherry-pick SHA --strategy-option theirs

and get a conflict like this waiting for manual resolution:

deleted by us: SOME_FILE

Is there a way to make git automatically resolve such conflicts by adding files deleted by us?

Answer

Rahul R. picture Rahul R. · Dec 27, 2017

deleted by us are the new files which you added in your commit (getting cherry picked). But these files are not present in the current branch (the one in which you are cherry-picking into).

So in this case you have to add these files manually by running:

git add <file-path>

However if you think, these files will no longer be needed in the current branch after cherry picking, in that case you can do:

git rm <file-path>