文档说:
Information about what is to be pushed is provided on the hook's standard input with lines of the form:
< local ref> SP < local sha1> SP < remote ref> SP < remote sha1> LF
For instance, if the command +git push origin master:foreign+ were run the hook would receive a line like the following:
refs/heads/master 67890 refs/heads/foreign 12345
我如何访问 pr-hook 脚本中的那些行?
最佳答案
可以使用以下方式访问远程分支名称:
while read local_ref local_sha remote_ref remote_sha
do
echo $local_ref
echo $local_sha
echo $remote_ref
echo $remote_sha
done
关于git - 如何在git pre-push hook中获取远程分支名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21556589/