之间分支合并冲突我有2个服务器:example.com和example.net的Git大师和新科
,我有2个的Git分支:主机(example.com)和β(example.net)
现在,有一个在主分支中的文件名为config.php
其中包含数据库的详细信息:
$db_name : 'com_dbname';
当我创建beta
分支,我需要改变这一行,因此它可以在example.net运行:
$db_name : 'net_dbname';
so,config.php
现在每个分支都不同。现在两个分支都已提交并推送到远程存储库。
开发过程仍在主分支上继续。我需要添加下$db_name
一些行:
$db_name : 'com_dbname';
$other_var : 'other_value';
通常我可以合并到主分支测试在我到位桶帐户。但由于此文件已更改,因此我无法将主合并到测试版分支中。这就是它说的:
这种合并有冲突,必须解决之后才能提交。 手动合并这些变化到测试运行以下命令:
$ git checkout 94c22fbaa758
# Note: This will create a detached head!
$ git merge remotes/origin/master
,这里是我的终端上的输出:
Note: checking out '94c22fbaa758'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 94c22fb...
git merge remotes/origin/master
Already up-to-date.
我很困惑。它说一切都已经是最新的,但我仍然在我的bitbucket上看到1 commit behind master.
,仍然无法将主控合并到测试版分支。
请亲切地帮助我。我真的不知道如何解决这个问题,而且我在过去2个月前使用git,之前从未遇到过这种分支合并的情况。非常感谢你。
你写了“这是它说什么”,但没有说出“它”是什么。 bitbucket上的一些网页操作? – torek
@torek:是的,它= bitbucket。在分支菜单上。 –
我自己并没有使用bitbucket(当然,因为它是严格的Mercurial,并且我没有写信给它),但是似乎你需要首先运行'git fetch',以便从中央repo通过bitbucket进入你的本地仓库,你可以在那里工作。 – torek