Switch git 分支不更新文件
Switch git branch not updating files
我创建了一个新分支并添加了一些文件。
我在本地使用 tortoise 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.
这是为什么?
您似乎已经有一个名为 mynewbranch
的本地分支,但该分支没有您要查找的最新更改。然而,这些变化确实存在于起源中。因此,当您 git checkout origin/mynewbranch
时,您可以看到更改。如果您想将这些更改拉入本地 mynewbranch
分支,请发出以下命令:
git checkout mynewbranch
git pull . origin/mynewbranch
我创建了一个新分支并添加了一些文件。
我在本地使用 tortoise 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.
这是为什么?
您似乎已经有一个名为 mynewbranch
的本地分支,但该分支没有您要查找的最新更改。然而,这些变化确实存在于起源中。因此,当您 git checkout origin/mynewbranch
时,您可以看到更改。如果您想将这些更改拉入本地 mynewbranch
分支,请发出以下命令:
git checkout mynewbranch
git pull . origin/mynewbranch