Git 将更改从master合并到我的分支
我在git中有两个分支:Git 将更改从master合并到我的分支,git,github,version-control,git-merge,Git,Github,Version Control,Git Merge,我在git中有两个分支:master和custom\u分支 有人在master中添加了一些代码,我需要在我的custom\u分支中使用这些代码。我试过这个: git branch custom_branch git merge master 但当我这么做的时候,它说: Already up-to-date. 但是,当我比较master和custom\u branch时,变化仍然不存在。我错过了什么 另外,我不想重新设置基址,因为其他人也使用此分支。git checkout custom\u分
master
和custom\u分支
有人在master
中添加了一些代码,我需要在我的custom\u分支中使用这些代码。我试过这个:
git branch custom_branch
git merge master
但当我这么做的时候,它说:
Already up-to-date.
但是,当我比较master
和custom\u branch
时,变化仍然不存在。我错过了什么
另外,我不想重新设置基址,因为其他人也使用此分支。git checkout custom\u分支和git-rebase master
这将使用master
分支的更改更新custom\u分支
别忘了首先确保主文件
是最新的<代码>git pull
这也可以通过
git checkout custom_分支和&git merge master来实现
要解释为什么(可能)第一个是您应该使用的:回答我自己的问题,但要将上游主节点的更改拉入我的自定义分支,我做了以下操作:
git pull [URL TO UPSTREAM'S REPO] master
谢谢,但我不想重新设置基础,因为其他人也在使用此分支。另外,运行第二个命令表示所有内容都已更新。@Darth.Vader在尝试合并之前是否运行了git pull
?因为使用您提供的git branch custom\u branch
命令,您不会更改为custom\u branch
,只需停留在master
。执行git checkout custom_分支
,如果在您创建custom_分支
之后主控台在主控台中有一些更改,那么如果您想将更改合并到您的custom_分支
Executegit merge master
。我在回答中已经提出了这个建议,但是他似乎有一个问题,git没有认识到变化。有同样的问题。已多次重新设定并尝试合并。git说是最新的,但更改没有合并到我的自定义分支。当我签出主分支时,我可以看到更改。最后我做了git拉取原始主分支