2015-11-10 115 views
1

我创建了一个新的分支并添加了一些文件。切换git分支不更新文件

本地我使用龟GIT,当我切换到新的分支,文件被更新。

在使用CLI的我的生产服务器上,当我切换到git checkout mynewbranch的新分支时,文件不会更新。

当我git checkout origin/mynewbranch切换时,文件被更新,但我得到了以下信息:

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. 

这是为什么?

回答

2

看起来好像您已经拥有名称为mynewbranch的本地分行,但此分支没有您正在寻找的最近更改。但是,这些变化确实存在于原点中。正因为如此,当你git checkout origin/mynewbranch你可以看到变化。如果您想将这些更改引入本地mynewbranch分支,请发出以下命令:

git checkout mynewbranch 
git pull . origin/mynewbranch 
+0

完美运行。 –