Git - 推送到远程存储库中的远程跟踪分支
当简单地向远程存储库执行 git push 时,其 master 分支就会更新。对于非裸存储库来说,这是不希望出现的情况,最近的 Git 版本显示的警告消息清楚地表明了这一点。
我希望能够推送到远程存储库,并更新其远程跟踪分支之一。稍后,当我登录到远程计算机并运行命令时,我可以选择将该远程跟踪分支合并到 master 中。
我怎样才能做到这一点?或者是否有更好的方法将更改推送到非裸存储库?
When simply doing git push
to a remote repository, its master
branch gets updated. This is undesirable in the case of non-bare repositories, and the warning message displayed by recent Git versions makes that clear.
I'd like to be able to push to a remote repository, and have one of its remote tracking branches be updated. Later, when I log in to the remote machine and run commands, I can choose to merge that remote tracking branch into master
.
How can I do that? Or is there a better way to push changes to a non-bare repository?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以这样做:
例如:(
尽管仍然不建议推送到非裸存储库。)
You can do:
for example:
(Although it is still not recommended to push to non-bare repository.)
我想你应该只设置一个单独的裸存储库,即。没有工作副本的一份。然后,您可以登录到远程计算机并克隆此远程存储库,并在需要时获取/拉取。
I guess you should just set up a separate bare repository, ie. one without a working copy. Then you could just log in to the remote machine and clone this remote repository, and fetch/pull whenever you need it.