这种行为对我来说更像是一个bug,但也许我还有所疏漏。
首先,这就是我所做的:
首先,这就是我所做的:
0) `mkdir mytest && cd mytest`
1) `git init`: Created an empty git repo
2) `echo "test" >test.txt && git commit -a -m "init"`: Created 1 commit with a single file
3) `echo "test2" >test.txt && echo "test2" >test2.txt`: Made some changes in the file i committed + created a new file
4) `git stash -u`: Used stash -u to save my changes
5) `echo "test3" >test.txt && git commit -a -m "2"`: Created a second commit with a different change on the existing file in order to force a conflict
6) `git stash pop`: I git stash pop to create a conflict between the second commit and my stash from my first commit
我原以为我的当前工作目录中会有一个冲突的文件和一个未跟踪的文件,但是当我运行 git status
命令时,我只发现了冲突的文件:
mytest git:(master) ✗ git status
On branch master
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: test.txt
这是预期的行为吗?我该如何解决冲突并找回我的未跟踪文件?
git stash
。这个命令在历史上有很多bug,而且似乎又出现了一个新的。它会做一些不应该做的事情(创建提交,但你无法以任何正常方式找到或使用它们),而且使用起来很困难。 - torek