Find commits that modify file names matching a pattern in a GIT repository

后端 未结 7 1695
礼貌的吻别
礼貌的吻别 2021-02-03 18:36

I\'d like to find commits in my code base that add video files to throw them out. Is there a way to look for these files in git ?

For example let\'s say all videos have

7条回答
  •  情书的邮戳
    2021-02-03 19:19

    you can use git log with a pathspec:

    git log --all -- '*.wmv'
    

    this will get you all commits which make changes to .wmv files. yes, this will descend into subdirectories too (but you have to surround your pathspec with single quotes, so it will be passed as is to git).

    if you are only interested in commit hashes (scripting etc.) use the git rev-list machinery directly:

    git rev-list --all -- '*.wmv'
    

提交回复
热议问题