【问题标题】:Use git-filter-repo to filter out a list of files in commits which are not descendants of a given commit使用 git-filter-repo 过滤掉提交中不是给定提交的后代的文件列表
【发布时间】:2021-06-13 17:51:14
【问题描述】:

似乎git filter-branch 已被弃用,而应使用git-filter-repo。我正在使用git filter-branch --index-filter 从提交中删除不是给定提交的后代的文件列表。这样做就像

git filter-branch --index-filter 'git merge-base --is-ancestor aaaaaaaa $GIT_COMMIT ; if [ $? -eq 1 ] ; then git rm --cached --ignore-unmatch a.txt b.txt c.txt ; fi' HEAD

所以a.txtb.txtc.txt 会从不是aaaaaaaa 后代的任何提交中删除。有没有办法通过git-filter-repo 实现这一目标?

【问题讨论】:

    标签: git git-filter-repo


    【解决方案1】:

    git filter-branch 用于它的好处,使用git filter-repo 用于它更好的用途。我怀疑是否有可能让 filter-repo 完全按照您的要求做,或者至少做得不太好。

    我建议忽略大多数针对 git filter-branch 的批评,尤其是 filter-repo 自述文件中的批评,令人遗憾的是夸大了。将export FILTER_BRANCH_SQUELCH_WARNING=1 放入~/.bashrc 即可。

    【讨论】:

      猜你喜欢
      • 2013-10-04
      • 2022-07-06
      • 1970-01-01
      • 1970-01-01
      • 2020-07-02
      • 1970-01-01
      • 1970-01-01
      • 2018-10-02
      • 2022-01-24
      相关资源
      最近更新 更多