Reputation: 5843
I have a branch A
with certain files in foo/
in tact, and I have a branch B
with a number of files in foo/
deleted throughout a number of commits.
How can I delete same files in A
's foo/
which are deleted in B
's foo/
?
Upvotes: 1
Views: 41
Reputation: 7358
I don't know of any command on the Git client that does this kind of operation on the index and working tree. The only command that distinguishes the types of changes is git diff
, as far as I remember.
You may have to write a script that loops over a diff filtered by deletes (See Filter git diff by type of change).
Or if you can use xargs and pipes it's pretty simple:
git checkout A
git diff --diff-filter D --name-only HEAD B | xargs git rm
Upvotes: 2