Git
Git是一套版本控制系統(VCS)。
Hook
可以設計一些hook在本地端擋住常見的錯誤行為。
禁止develop
從其他branch rebase更新,但允許origin/develop
,放在~/.git/hooks/pre-rebase
:
#!/bin/bash
# $1: source branch.
# $2: destination branch (empty if it's current branch).
if [[ "$2" = "develop" || ( "$2" = "" && "$(git rev-parse --abbrev-ref HEAD)" = "develop" ) ]]; then
if [[ "$1" = "origin/develop" ]]; then
# OK
exit 0
fi
echo "You cannot rebase develop branch from branch other than origin/develop."
exit 1
fi
外部連結
- 官方網站 {{en}