我的本地 git 存储库需要从一台服务器拉取。然后,它需要将特定分支推送到不同服务器上具有不同分支名称的审查存储库。
就像是:
从 Server1 上的 PullOnlyRepo 中提取所有内容(也许我们会称之为 origin?)
将分支修补程序推送到 Server2 上分支名称为 JistChanges 的 ReivewRepo。
现在 git config -l 显示:
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=<URL for Server1>
remote.origin.pushurl=no_push (this shouldn't matter since it is a pull only repo)
branch.production.remote=origin
branch.production.merge=refs/heads/production
remote.review.url=<URL for Server2>
remote.review.fetch=+refs/heads/*:refs/remotes/review/*
git pull 执行我想要的操作(从 Server1 上的正确位置获取更改并将它们合并到我的工作树中)。
然而 git Push 却没有。为了实现我想要的我必须做
git push review hotfix:JistChanges
有没有什么方法可以让 git pull 做到这一点,而不必放入额外的东西?
已经设置了一些问题,以便您的本地分支推送到具有不同分支名称的远程。然而,它们也改变了上游和拉力的来源。
您可以设置upstream https://stackoverflow.com/questions/2739376/definition-of-downstream-and-upstream/2749166#2749166分支为hotfix
:
git config push.default upstream
git config push.default review
git branch --set-upstream hotfix review/JistChanges
See "如何让现有的 git 分支跟踪远程分支? https://stackoverflow.com/questions/520650/how-do-you-make-an-existing-git-branch-track-a-remote-branch"
See "结果是什么git push origin? https://stackoverflow.com/questions/4586687/what-is-the-result-of-git-push-origin/9749477#9749477“默认情况下push
政策(即将“simple
")
启动git1.8.0:
git branch -u review/JistChanges hotfix
The OP吉斯坦白痴 https://stackoverflow.com/users/1426193/jistanidiot reports https://stackoverflow.com/a/12975402/6309取得了相同的结果:
git remote set-url --push origin
git config remote.origin.push refs/heads/hotfix:JistChanges
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)