How to prevent certain branches from overflowing like "master"

Is there a way to prevent a silly mistake like reloading master to a different branch?

It might be possible to reverse this using a reflog, but I'd like to avoid the trouble by preventing the redirect in the first place.

+3


source to share


2 answers


This example shows how to use a hook pre-rebase

to avoid git being rebased the way you want.

https://gist.github.com/uasi/9384329



You just need to pre-configure which branches you want to avoid reloading via git config

+5


source


There is a 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.

      



Perhaps you can use this to implement the functionality you are asking for.

+3


source







All Articles