如何防止某些分支的 rebase,例如 'master'
How to prevent rebase of certain branches, such as 'master'
有什么方法可以防止像将 master 变基到另一个分支这样的愚蠢错误吗?
也许可以使用 reflog 撤消此操作,但我想通过首先防止变基来避免麻烦。
有一个pre-rebase
git挂钩:
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.
您或许可以使用它来实现您所询问的功能。
这个要点展示了如何使用 pre-rebase
钩子来避免 git 以你想要的方式变基。
https://gist.github.com/uasi/9384329
您只需预先配置要避免通过 git config
变基的分支
有什么方法可以防止像将 master 变基到另一个分支这样的愚蠢错误吗?
也许可以使用 reflog 撤消此操作,但我想通过首先防止变基来避免麻烦。
有一个pre-rebase
git挂钩:
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.
您或许可以使用它来实现您所询问的功能。
这个要点展示了如何使用 pre-rebase
钩子来避免 git 以你想要的方式变基。
https://gist.github.com/uasi/9384329
您只需预先配置要避免通过 git config