git branch commit不会合并到master

时间:2018-08-15 05:49:14

标签: xcode git github core-data

在git窗口中,我执行了以下命令:

git branch 
master
*wcopy

git commit -am "modified provider features"
On branch wcopy
Your branch is up to date with 'origin/wcopy'.

nothing to commit, working tree clean

git merge wcopy
Already upto date

git push origin master
Everything up-to-date

我去git hub仓库 分支主管说: 9天前的最新提交

分支wcopy说: 该分支前面2个提交,后面5个master提交。 18分钟前最新提交db8bdca

我检查了brnach wcopy代码是否最新 但是主人在后面。

我通过git命令合并到master中,但是它仍然显示两个单独的分支,其中master位于wcopy后面

(1)我该如何使大师保持最新状态? (2)另外,我在源代码上将文件DB / Model.xcdatamodeld重命名为Model.xcdatamodeld。 但是wcopy分支将路径显示为 DB / Model.xcdatamodeld / GridModel.xcdatamodel 说此路径跳过空目录。 如果我查看源代码上的实际代码,它将正确显示为DB / Model.xcdatamodeld 我不知道为什么会有所不同?

2 个答案:

答案 0 :(得分:1)

  

我通过git命令合并到master中,但是它仍然显示两个单独的分支,其中master位于wcopy后面

执行此操作时:

git merge wcopy

您将wcopy合并到了自己的wcopy分支中,该分支当然什么也没做。您应该先切换master分支,然后进行合并:

git checkout master
git merge wcopy
# resolve possible merge conflicts...
git push origin master

答案 1 :(得分:1)

代替这样做:

git merge wcopy

这样做可以将wcopy合并到自身中(这不是您所需要的)。您应该切换master分支,然后通过以下操作将合并的wcopy分支合并到master

git pull origin wcopy
# to make sure you are up to date on wcopy branch
git checkout master
# to have your master branch up to date with the remote.
git pull origin master
git merge wcopy
# resolve possible merge conflicts if any.
git push origin master

这应该可以解决所有问题,并将分支wcopymaster合并。