xrayx
xrayx

Reputation: 65

How to find file that is or was in remote branches by name?

How can I find file that is or was in all branches by name? I've many remote branches and I want search file by name if file is deleted I want know about it. I don't want download all branches and type git log in each of them.

Upvotes: 0

Views: 122

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 22067

git log --pretty=format:"%d" --diff-filter=D --all -- *filename*

might do the trick for you? (to be run once from any branch, not from each branch like you rightfully want to avoid)

I suggested to output decoartions here (%d) to output branch info rather than just commits, but in the case when your branch doesn't point at the specific commit(s) where the file has been deleted, it won't work.

You'll have to just output its hash (--pretty=format:"%h") then

git branch -a --contains <hashYouFound>

then it'll output every branch which has this commit (where the file has been deleted)

Upvotes: 1

Related Questions