Query git reflog for all commits to a specific file

前端 未结 4 653
攒了一身酷
攒了一身酷 2020-12-13 01:43

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

4条回答
  •  攒了一身酷
    2020-12-13 02:29

    I lost a change when I was cleaning up my history with rebase. I used something like this to search the reflogs:

    for r in $(git reflog -- ${file} | cut -d ' ' -f1); do git show ${r}:${file}; done
    

提交回复
热议问题