-
-
Save ismaelhamed/2aa4b9040a74183a1d18dc8585e86b5b to your computer and use it in GitHub Desktop.
A pre-rebase hook that refuses to rebase if "branch.${BRANCH}.rebaselock" is true.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config branch.master.rebaselock true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# The "pre-rebase" hook is run just before "git rebase" starts doing | |
# its job, and can prevent the command from running by exiting with | |
# non-zero status. | |
# | |
# The hook is called with the following parameters: | |
# | |
# $1 -- the upstream the series was forked from. | |
# $2 -- the branch being rebased (or empty when rebasing the current branch). | |
# | |
branch="$2" | |
[ -n "$branch" ] || branch=`git rev-parse --abbrev-ref HEAD` | |
lock="branch.${branch}.rebaselock" | |
if [ x`git config --bool "$lock"` = xtrue ]; then | |
echo "pre-rebase hook: \"$lock\" is set to true. Refusing to rebase." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment