Query git reflog for all commits to a specific file

Is it possible to check the git reflog for all commits to a specific file.

I made a commit to file foo.txt and now it no longer shows in the git history via

git log foo.txt

I want to search the reflog to find all commits to this file so I can find my "lost" commit.


Try:

git rev-list --all -- foo.txt

This will give you a list of all commits containing foo.txt.


I'd use:

git rev-list --all --remotes --pretty=oneline foo.txt

The --remotes option lets you use also your remotes, the --pretty=oneline makes it display also the commit message. Very useful when you're looking for a modification pushed to remote in a branch you don't know the name of.


在搜索答案时遇到了这个问题,这很简单: git reflog $PATH ,其中包含修改和其他操作,否则将不会显示(尽管要注意,reflog将被gc修剪)

链接地址: http://www.djcxy.com/p/23518.html

上一篇: 如何在git中清除我的本地工作目录?

下一篇: 查询git reflog以获取对特定文件的所有提交