我想我做了不该做的事。我尝试使用 stash,但认为我应该分支,并在那里做。无论如何,这些是我所做的命令:
git branch test # created my test branch
git checkout test # moved to my test branch
git status # showed that the files were still changed.
git stash # testing stash
git stash list # showed that the stash was there
git status # showed that the files were still changed?
git diff # showed that the differences were only file permissions.
git stash apply # Tried to get back my changes. States:
# error: Your local changes to the following files would be overwritten by merge:
# ...
# Please, commit your changes or stash them before you can merge.
# Aborting
git commit file -m "- committing test code that doesn't work."
git status # Shows that it's clean
所以,我认为问题在于分支和签出会擦除我的更改而不是保留它们。那是对的吗?如果没有,我可以取回我的更改吗?