5

So there was a file in one of my projects which was deleted, no one knows when or why, it's just gonne. (a few months probably). Problem is i only know a part of the name, not the full name. How can i search the files added/removed in commits (not commit message) for this?

The file should look like something_something.*.xml, any ideas? [the * can be a string, or multiple string separated by underscore, dash or dot]

lordZ3d
  • 540
  • 6
  • 20

1 Answers1

6

You can do git log --all --full-history -- **/theFile.*

Gonzalo Matheu
  • 8,984
  • 5
  • 35
  • 58
ggorantala
  • 196
  • 2
  • 16
  • try using a relative path rather than absolute path – ggorantala Jan 04 '19 at 13:56
  • If it's possible for the file to be in the root, then they may need to also have `theFile.*` as a separate pathspec; in my tests `**/theFile.*` misses this case. – Mark Adelsberger Jan 04 '19 at 15:22
  • @MarkAdelsberger: `**/` is intended to match the root as well, so I'd suggest reporting a bug. Of course if you do have the bug, use `'**/*remembered_part*' '*remembered_part*'` to work around it, yes. – torek Jan 04 '19 at 19:02
  • At least in git version `2.39.2` on Apple. The pattern matching in filename won't work without double quotes. This command works: `git log --all --full-history -- "**/theFile.*" ` – Václav Jun 02 '23 at 20:57
  • I am running git v 2.39.2 (Apple Git-143) on a M2. I don't need quotes. #works-on-my-machine – LosManos Aug 17 '23 at 11:24