Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将git用于两个分支_Php_Git_Netbeans - Fatal编程技术网

Php 将git用于两个分支

Php 将git用于两个分支,php,git,netbeans,Php,Git,Netbeans,我想我会在Master Branch中使用这三个文件吗 大师: 现在我从Master创建一个分支 纽伯兰: 现在我将编辑Master index.php文件,并向Master branch添加两行代码 大师: 我会在NewBranch更改一些代码 纽伯兰: 我想更新NewBranch,这样我就可以在新分支上编辑我自己的行,也可以在主分支上更新行 纽伯兰:应该如下所示 我怎样才能做到这一点?我使用了netbeans拉取,但没有起作用。我也不想使用git子模块,因为我没有单独的文件夹 您应该提交两个

我想我会在Master Branch中使用这三个文件吗

大师:

现在我从Master创建一个分支

纽伯兰:

现在我将编辑Master index.php文件,并向Master branch添加两行代码

大师:

我会在NewBranch更改一些代码

纽伯兰:

我想更新NewBranch,这样我就可以在新分支上编辑我自己的行,也可以在主分支上更新行

纽伯兰:应该如下所示

我怎样才能做到这一点?我使用了netbeans拉取,但没有起作用。我也不想使用git子模块,因为我没有单独的文件夹

您应该提交两个分支上的更改。只有改变是没有好处的。 然后你可以在master git上重新设置你的NewBranch的基础,重新设置master NewBranch的基础 现在,您的新分支自身和主分支都发生了变化。但大师只有它的变化。
有关rebase的更多详细信息,请参阅。

假设您使用的是gitBash,这些步骤如下:

git checkout newbranch
为newbranch做更改 git commit-a-m您的消息

git checkout master
为master做更改

git commit -a -m "Your message"
正在合并

git checkout newbranch
git merge master
git push
git checkout master
git merge newbranch
git push
gitk //you should see that both are at the same level in the git tree

那么,您想将主分支合并到新分支,同时保持主分支不变?是的,我将合并两个分支,但当我使用netbeans pull进行合并时,it show me>需要合并提交才能将当前分支与Origon/master同步您想将当前分支与origin/master合并还是将其重设为origin/master?合并重基取消,当我单击“合并”时,它不会合并新的lines@Ata:是否进入无冲突解决阶段?您的示例将导致合并冲突否,它不会显示任何冲突当我使用Rebase时,虽然我预期合并对我的工作已经足够,但我将无法再提交我的新牧场。
index.php

     <b>hello</b>
     <div>this is new branch line</div>
     <a>test</a>
     <p>good</p>  
git checkout newbranch
git checkout master
git commit -a -m "Your message"
git checkout newbranch
git merge master
git push
git checkout master
git merge newbranch
git push
gitk //you should see that both are at the same level in the git tree