我的gitlab账户中有两个项目,分别名为zip/production (master)和map/production (从master派生而来)。每当我对zip/production进行更改时,都应该自动更新到map/production,但应该保持map/production中的附加文件不变。这个是可能的吗?
发布于 2016-09-15 23:53:34
这不仅是可能的,而且非常简单!
# .git/hooks/post-receive on the remote:
#!/usr/bin/bash
IFS=' '
while read local_ref local_sha remote_ref remote_sha
do
echo "$remote_ref" | egrep '^refs\/heads\/[A-Z]+-[0-9]+$' >/dev/null && {
ref=`echo $remote_ref | sed -e 's/^refs\/heads\///'`
echo Forwarding feature branch to features-only repository: $ref
git push -q features-only $ref --force
}
done此示例仅采用分支的一个子集(采用Jira发布格式,XYZ-1234),并将它们转发到第二个存储库。当然,您可以离开条件,以转发所有内容。
https://stackoverflow.com/questions/39510314
复制相似问题