Jis*_*iot 7 git git-remote git-branch
我的本地git repo需要从一台服务器上拉.然后,它需要将特定分支推送到具有不同服务器上的不同分支名称的审阅存储库.
类似于:从Server1上的PullOnlyRepo中拉出所有内容(我们可能会调用该来源吗?)将Branch分支修补程序推送到ReivewRepo,在Server2上使用分支名称JistChanges.
现在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/*
Run Code Online (Sandbox Code Playgroud)
git pull做我想要的(从Server1上的正确位置获取更改并将它们合并到我的工作树中).
但是git push没有.为了实现我想要的我必须做的事情
git push review hotfix:JistChanges
Run Code Online (Sandbox Code Playgroud)
是否有一些方法可以让git pull做到这一点,而不必添加额外的东西?
已经设置了一些问题,以便您的本地分支推送到具有不同分支名称的远程.然而,它们也改变了上游和拉动的来源.
您可以设置上游分支hotfix:
git config push.default upstream
git config push.default review
git branch --set-upstream hotfix review/JistChanges
Run Code Online (Sandbox Code Playgroud)
请参阅“如何使现有的 git 分支跟踪远程分支? ”请参阅默认策略上的“结果是什么git push origin?push ” (很快将成为“ simple”)
启动git1.8.0:
git branch -u review/JistChanges hotfix
Run Code Online (Sandbox Code Playgroud)
OP jistanidiot 报告取得了相同的结果:
git remote set-url --push origin
git config remote.origin.push refs/heads/hotfix:JistChanges
Run Code Online (Sandbox Code Playgroud)