today I had some changes to a file sitting on an old branch from a couple months ago, and I wasn’t sure which branch. stackoverflow user BigMiner shared this, which worked great:
I have been looking at this closely and all these answers don‘t seem to really show me all the commits across all the branches.
Here is what I have come up with by messing around with the gitk edit view options. This shows me all the commits for a file regardless of branch, local, reflog, and remote.
gitk --all --first-parent --remotes --reflog --author-date-order -- filename
Code language: PHP (php)It also works with
git log
:
git log --all --first-parent --remotes --reflog --author-date-order -- filename
Code language: PHP (php)