有没有办法防止一个愚蠢的错误,例如将master重新绑定到另一个分支上?
有可能通过使用reflog来撤消这一点,但我想通过首先防止rebase来避免麻烦。
答案 0 :(得分:6)
这个要点展示了如何使用pre-rebase
钩子来避免git rebase的方式。
https://gist.github.com/uasi/9384329
您只需要预先配置要避免通过git config
答案 1 :(得分:3)
有一个pre-rebase
git hook:
pre-rebase
This hook is called by git rebase and can be used to prevent a branch
from getting rebased. The hook may be called with one or two
parameters. The first parameter is the upstream from which the series
was forked. The second parameter is the branch being rebased, and is
not set when rebasing the current branch.
您可以使用它来实现您所询问的功能。