【问题标题】:How to detect a git push --force [duplicate]如何检测 git push --force [重复]
【发布时间】:2016-07-10 15:16:07
【问题描述】:

关于 git push --force 的三个问题:

有没有办法检测团队中的某个人何时使用 git push --force ?

当我的本地 git 安装检测到 git push --force 时,是否可以制作一个发送电子邮件的钩子?

有没有办法在这个 git push --force 之后查看我的分支上是否有一些提交消失了?

【问题讨论】:

标签: git


【解决方案1】:

有没有办法检测团队中的某个人何时使用 git push --force ?

是的。

你有这个可以使用的钩子:
https://github.com/kyanny/git-hooks-detect-force-update


当我的本地 git 安装检测到 git push --force 时,是否可以制作一个发送电子邮件的钩子?

第一个答案是 hook,因此您可以从 hook 发送电子邮件。


有没有办法在这个 git push --force 之后查看我的分支上的某些提交是否消失?

不是直接的,你必须扫描 repo 中的悬空对象。

git fsck --full

但是在上面的钩子中你会得到将被删除的提交

【讨论】:

    猜你喜欢
    • 2012-09-16
    • 1970-01-01
    • 1970-01-01
    • 2021-11-19
    • 2012-08-31
    • 2014-06-19
    • 2014-11-11
    相关资源
    最近更新 更多