我正在做一个分支的工作,我想要切换到另一个分支来快速地改变其他的东西,所以我做了。
git stash然后git status显示
On branch <branch-1>
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: <test-file>所以我换到了第二个分支
git checkout <other-branch>但当我这么做的时候
git status它显示了
On branch <branch-2>
Untracked files:
(use "git add <file>..." to include in what will be committed)
file
nothing added to commit but untracked files present (use "git add" to track)更改后的文件(在原始分支中跟踪)显示在第二个分支中的未跟踪列表中,即使它已被存储。如果藏起来了,难道不应该藏起来吗?
编辑-1:如果有区别的话,我正在尝试保存对二进制文件的更改。
编辑-2:完全可复制的示例
拥有branch-1和branch-2
关于branch-1对file的更改
git add .
git stash
git checkout <branch-2>然后git status显示
On branch <branch-2>
Untracked files:
(use "git add <file>..." to include in what will be committed)
file
nothing added to commit but untracked files present (use "git add" to track)发布于 2022-08-26 07:37:26
如果还想保存未跟踪的文件,请使用git stash --include-untracked
https://stackoverflow.com/questions/73497404
复制相似问题