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

后端 未结 7 1698
礼貌的吻别
礼貌的吻别 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:43

    If the goal is to remove the files from the repository (thus rewriting history), use the BFG Repo-Cleaner, e.g.:

    bfg --delete-files '*.wmv' --private --no-blob-protection
    

    If the files are relevant, you can keep them under version control using Git LFS. To migrate (also rewriting history), you do something such as:

    git-lfs-migrate \
        -s original.git  \
        -d converted.git \
        -l https://user:passwd@custom-server.org:8080 \
        '*.wmv'
    

    To simply list or examine the commits, I refer to knittl's answer:

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

提交回复
热议问题