Git - 推送到远程存储库中的远程跟踪分支 [英] Git - push to a remote-tracking branch in the remote repository

查看:233
本文介绍了Git - 推送到远程存储库中的远程跟踪分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当仅仅执行 git push 到一个远程仓库时,它的 master 分支会被更新。这对于非裸仓库是不可取的,最近的Git版本显示的警告信息使得这一点很清楚。

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.

我希望能够推到一个远程仓库,并且有一个远程跟踪分支被更新。稍后,当我登录到远程机器并运行命令时,可以选择将该远程跟踪分支合并到 master 中。

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?

推荐答案

您可以这样做:

git push master:some-remote-branch


例如:



for example:

git push master:alex/master

(尽管仍不建议推送到非裸仓库。)

(Although it is still not recommended to push to non-bare repository.)

这篇关于Git - 推送到远程存储库中的远程跟踪分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆