git - GIT 分支结帐文件未更新
问题描述
我有一个通过 GIT GUI 从 master 创建的分支 testbranch。目前我在 GIT 命令行上掌握。
当我说 "git branch -b testbranch"
and时"git checkout testbranch"
,它说它切换到了,testbranch
但文件没有更新。我不知道为什么会出现这种奇怪的行为。
git branch testbranch
还有和之间有什么区别 git branch -b testbranch
。
解决方案
这就是为什么旧的过时且令人困惑的git checkout
命令已被替换为:
在您的情况下,如果文件在结帐后没有正确更新,您可以强制它们:
git restore --source=HEAD --staged --worktree hello.c
(假设您没有任何正在进行的工作)
推荐阅读
- sql - SQL 包含带有分区聚合的子句
- amazon-web-services - 通过 Cloudformation 模板具有 lambda 目标的 AWS ALB
- python - Python,如何同时打印所有键的值?
- javascript - 防止背景在后台滚动
- c# - 脚本任务问题列出目录中的excel文件
- javascript - 如何防止可能的嵌套承诺?
- bash - iTerm2 & Atom - 根据 ~/.bash_profile 中的输入 bash 命令切换配置文件,寻找建议
- python - Python 3.4 和 AVRO:无法根据模式转换 AVRO 中的简单消息?
- python - 如何设计减少 Numba Cuda 内核中的寄存器使用?
- qt - 使用 QtQuick Loader 与可见属性