如何快速转发分支而不检出 [英] How can I fast-forward a branch without checking it out

查看:91
本文介绍了如何快速转发分支而不检出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的生产服务器上,我只有 master 总是被签出。



我做 git pull ,它也会更新 develop 分支。



当我承诺生产服务器上的 master ,并尝试 git push ,它抱怨 develop 非快进更新被拒绝。

我该如何处理 master 没有遇到与其他分支有关的问题?我甚至不想知道其他分支机构是否适合本地回购。

您可以指定分支:

>

  git push origin master 

如果您没有指定分支,它将与您在 .git / config 中的内容一致。



因此,如果您始终只想在生产服务器上处理 master ,请更新 .git / config 在那里删除其他的分支关联(所以留下 [branchmaster] 部分但是删除 [branchdevelop] section),然后您可以再次使用 git push ,而无需参数。


On my production server, I just have master always checked out.

I do git pull, which also updates develop branch.

When I commit to master on the production server, and try to git push, it complains for develop that "non-fast-forward updates were rejected".

How can I deal with master without ever getting problems related to other branches? I don't even want to know about other branches for this local repo.

解决方案

You can specify the branch:

git push origin master

If you don't specify the branch, it goes with what you have in .git/config.

So if you always want to only deal with master on the production server, update the .git/config there removing the other branch associations (so leave the [branch "master"] section but remove the [branch "develop"] section), and then you can just git push again with no arguments.

这篇关于如何快速转发分支而不检出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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