所以我用一些未跟踪的文件藏起来
git stash --include-untracked
Run Code Online (Sandbox Code Playgroud)
然后切换到另一个分支.
如果我看看哪些变化被隐藏了:
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 +++++++++++
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用检索这些文件
git stash pop
Run Code Online (Sandbox Code Playgroud)
得到这个:
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
Run Code Online (Sandbox Code Playgroud)
请注意,没有一个文件是相同的?
这里发生了什么?
谢谢!
在下面提到的博客中,有关如何应用通过-a代替创建的存储-u:
找到隐藏的提交:
git log --graph --all --decorate --oneline
Run Code Online (Sandbox Code Playgroud)
看看这个
git checkout <sha>
Run Code Online (Sandbox Code Playgroud)
重置父级:
git reset HEAD~1
Run Code Online (Sandbox Code Playgroud)
创建一个干净的存储区:
git stash -u
Run Code Online (Sandbox Code Playgroud)
现在master,您可以签出并应用新的存储。
https://blog.tfnico.com/2012/09/git-stash-blooper-could-not-restore.html#!
小智 5
我今天做了完全相同的事情,但没有找到有用的帮助。所以我做了这个技巧:
git checkout stash这将创建一个临时分支。然后你可以在它上面应用藏匿处。
git stash apply
手动将所有更改的文件复制到安全的地方。
忽略临时分支并结帐到原始分支。
将文件粘贴到您首先找到它们的位置。
完毕。
这个问题很老了。但答案可能会帮助像我这样的人。所以...
Ada*_*ruk -3
您应该忽略日志和其他不是源代码的文件。无论哪种方式,您都可以添加--force以覆盖它们。
在您的情况下发生的情况是,您隐藏的文件在弹出时会尝试覆盖工作文件夹中已有的文件。如果你在那里有重要的工作,git 会谨慎行事,不会盲目地覆盖它们。
最好的建议是清理你的设置:
.gitignore文件中。如果您是新手,请保持 webchat.freenode.net 上的 #git IRC 频道打开:)
| 归档时间: |
|
| 查看次数: |
7799 次 |
| 最近记录: |