In Git, how could I search for a file or directory by path across a number of branches?
I’ve written something in a branch, but I don’t remember which one. Now I need to find it.
Clarification: I’m looking for a file which I created on one of my branches. I’d like to find it by path, and not by its contents, as I don’t remember what the contents are.
git log+git branchwill find it for you:Supports globbing, too:
The single quotes are necessary (at least if using the Bash shell) so the shell passes the glob pattern to git unchanged, instead of expanding it (just like with Unix
find).