所以我用一些未跟踪的文件藏起来
git stash --include-untracked
然后切换到另一个分支。
如果我看看哪些变化被隐藏了:
backend/infinispan-rar/pom.xml | 12 ++++++++++--
backend/pom.xml | 13 +++++++++++--
backend/test/pom.xml | 3 +--
.../main/resources/com/mojiva/testDbContext.xml | 6 +++---
data/mojiva.xml | 2 +-
dbmigration/pom.xml | 16 ++++++++++------
.../main/resources/db/changelogs/issue-17544.xml | 4 ++--
pom.xml | 11 +++++++++++
然后我尝试使用检索这些文件
git stash pop
得到这个:
backend/activator/effective.pom already exists, no checkout
backend/adverter/src/test/java/com/mojiva/presenter/RequestParamReplacerTest.java already exists, no checkout
backend/dao/.cpath already exists, no checkout
backend/dao/.e0 already exists, no checkout
backend/dao/PutObjectStoreDirHere/defaultStore/Recovery/TransactionStatusManager/#22#/0_ffffc0a86465_cfd2_5016b5cb_1 already exists, no checkout
backend/dao/dep.tree already exists, no checkout
backend/feeds-test/.e0 already exists, no checkout
backend/feeds-test/dep.tree already exists, no checkout
data/wurfl-patch.xml already exists, no checkout
run/linksDB.log already exists, no checkout
run/linksDB.properties already exists, no checkout
run/linksDB.script already exists, no checkout
Could not restore untracked files from stash
请注意,没有一个文件是相同的?
这里发生了什么?
谢谢!
从下面提到的关于如何应用使用-a
而不是-u
创建的存储的博客:
找到存储的提交:
git log --graph --all --decorate --oneline
看看这个
git checkout <sha>
重置父母:
git reset HEAD~1
创建一个干净的藏匿处:
git stash -u
您现在可以结帐master
并应用新的藏匿处。
https://blog.tfnico.com/2012/09/git-stash-blooper-could-not-restore.html#!
我今天完成了同样的事情,没有找到有用的帮助。所以我做了这个伎俩:
git checkout stash
这将创建一个临时分支。然后你可以在上面申请藏匿。
git stash apply
完成。
这个问题很老了。但答案可能会帮助像我这样的人。所以...
您应该忽略日志和其他非源代码的文件。无论哪种方式,您都可以添加--force
来覆盖它们。
在您的情况下发生的事情是,您弹出的文件将会尝试覆盖您在工作文件夹中已有的文件。如果你在那里有重要的工作,git将安全地发挥作用,而不是盲目地覆盖它们。
最好的建议是清理你的设置:
.gitignore
文件中。如果您是新手,请在webchat.freenode.net上打开#git IRC频道:)