首页 > 解决方案 > GIT 分支结帐文件未更新

问题描述

我有一个通过 GIT GUI 从 master 创建的分支 testbranch。目前我在 GIT 命令行上掌握。

当我说 "git branch -b testbranch" and时"git checkout testbranch" ,它说它切换到了,testbranch但文件没有更新。我不知道为什么会出现这种奇怪的行为。

git branch testbranch 还有和之间有什么区别 git branch -b testbranch

标签: git

解决方案


这就是为什么旧的过时且令人困惑的git checkout命令已被替换为:

在您的情况下,如果文件在结帐后没有正确更新,您可以强制它们:

git restore --source=HEAD --staged --worktree hello.c

(假设您没有任何正在进行的工作)


推荐阅读