【问题标题】:git filter branch to git filter repo conversiongit filter 分支到 git filter repo 转换
【发布时间】:2020-09-19 05:16:25
【问题描述】:

我正在按照这个命令对我的 git 存储库中的所有提交执行更漂亮的操作:

git filter-branch --tree-filter 'prettier --write "**/**.js" || echo “Error formatting, possibly invalid JS“' -- --all

我想在git filter repo 中执行相同的操作,但我什至不确定这是否可以实现。任何人都可以帮助如何使用 git filter repo 解决这个问题吗?

【问题讨论】:

    标签: git git-filter-branch


    【解决方案1】:

    我想在 git filter repo 中执行相同的操作,但我什至不确定这是否可以实现

    是的,它是一个blob callback,允许您在所述 blob 上调用任何您想要的脚本/命令,类似于在 newren/git-filter-repo issue 45this example 中所做的操作

    git filter-repo --force --blob-callback '
      import black
      blob.data = black.reformat_commit(blob.data.decode(), mode=black.FileMode()).encode()
    '
    

    reformat_commit as in this python script

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-06
      • 2016-04-13
      • 2020-07-22
      • 2011-12-01
      • 2013-03-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多