我正在寻找一种将文本从外部拖到编辑器的方法。我在文档和我的Google研究中找不到任何内容。
testtip=`git rev-parse testing`
[[ `git merge-base testing master` = $testtip ]] && exit 0 # okay if testing's merged
while read old new ref; do
[[ $ref = refs/heads/* ]] || continue # only care about branches
[[ $new = *[^0]* ]] || continue # not checking branch deletions
[[ $ref = */master ]] && continue # not checking pushes to master
[[ $ref = */testing ]] && continue # nor testing
range=$new; [[ $old = *[^0]* ]] && range=$old..$new
[[ `git rev-list --first-parent $range` != *$testtip* ]] \
&& [[ `git rev-list $range` = *$testtip* ]] \
&& {
echo push to $ref merges from unmerged testing commits, rejecting push
exit 1
}
done