首页 > 解决方案 > 如何验证推送的提交?

问题描述

Github 提供了通过使用 GPG 对提交进行签名来验证提交的可能性。

完成此操作后,您将获得所有提交的验证/签名。但是,在执行此操作之前,我已经推送了提交。有没有办法验证/签署这些提交?

标签: github

解决方案


这将涉及重写存储库的历史记录,或者使用:

  • git rebase -i,git commit -S --amend --no-edit在每次提交时进行编辑
  • 或一个git filter-branch

类似this answer的内容,但使用您想要的任何标准:

git filter-branch --commit-filter 'if [ <some criteria> ];
  then git commit-tree -S "$@";
  else git commit-tree "$@";
  fi' HEAD

推荐阅读