我按照此命令对 git 存储库中的所有提交执行更漂亮的操作:
git filter-branch --tree-filter 'prettier --write "**/**.js" || echo “Error formatting, possibly invalid JS“' -- --all
我想在git 过滤器仓库 https://github.com/newren/git-filter-repo但我什至不确定这是否可以实现。任何人都可以帮助解决如何使用 git filter repo 来解决这个问题吗?
我想在 git filter repo 中执行相同的操作,但我什至不确定这是否可以实现
是的,这是一个斑点回调 https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#CALLBACKS并允许您在所述 blob 上调用您想要的任何脚本/命令,类似于newren/git-filter-repo 第 45 期 https://github.com/newren/git-filter-repo/issues/45#issuecomment-573339588, and 这个例子 https://gist.github.com/JacobHayes/9c86cc650c17a776f4a592fe0b2e7645
git filter-repo --force --blob-callback '
import black
blob.data = black.reformat_commit(blob.data.decode(), mode=black.FileMode()).encode()
'
With reformat_commit就像这个 python 脚本一样 https://gist.github.com/JacobHayes/9c86cc650c17a776f4a592fe0b2e7645.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)