我把零钱藏起来了。现在,我只想从隐藏中删除一些文件。我该怎么做呢?
当前回答
如果你git隐藏pop(没有冲突),它将删除隐藏后,它被应用。但是如果你git stash apply,它将应用补丁而不从stash列表中删除它。然后你可以用git checkout - files…
其他回答
git checkout stash@{N} <File(s)/Folder(s) path>
如。 若要仅恢复上次存储的./test.c文件和./include文件夹,
git checkout stash@{0} ./test.c ./include
我认为VonC的答案可能是你想要的,但这里有一种方法来做一个选择性的“git apply”:
git show stash@{0}:MyFile.txt > MyFile.txt
首先列出所有的藏匿物
git stash list
↓
stash@{0}: WIP on Produktkonfigurator: 132c06a5 Cursor bei glyphicon plus und close zu zeigende Hand ändern
stash@{1}: WIP on Produktkonfigurator: 132c06a5 Cursor bei glyphicon plus und close zu zeigende Hand ändern
stash@{2}: WIP on master: 7e450c81 Merge branch 'Offlineseite'
然后显示哪些文件在stash(让我们选择stash 1):
git stash show 1 --name-only
//Hint: you can also write
//git stash show stash@{1} --name-only
↓
ajax/product.php
ajax/productPrice.php
errors/Company/js/offlineMain.phtml
errors/Company/mage.php
errors/Company/page.phtml
js/konfigurator/konfigurator.js
然后应用你喜欢的文件:
git checkout stash@{1} -- <filename>
或整个文件夹:
git checkout stash@{1} /errors
它也可以没有-但建议使用它们。请看这篇文章。
通常还可以将双连字符识别为to的信号 停止选项解释并处理以下所有参数 字面上。
为例
git stash show --name-only
结果
ofbiz_src/.project
ofbiz_src/applications/baseaccounting/entitydef/entitymodel_view.xml
ofbiz_src/applications/baselogistics/webapp/baselogistics/delivery/purchaseDeliveryDetail.ftl
ofbiz_src/applications/baselogistics/webapp/baselogistics/transfer/listTransfers.ftl
ofbiz_src/applications/component-load.xml
ofbiz_src/applications/search/config/elasticSearch.properties
ofbiz_src/framework/entity/lib/jdbc/mysql-connector-java-5.1.46.jar
ofbiz_src/framework/entity/lib/jdbc/postgresql-9.3-1101.jdbc4.jar
然后弹出隐藏在特定的文件
git checkout stash@{0} -- ofbiz_src/applications/baselogistics/webapp/baselogistics/delivery/purchaseDeliveryDetail.ftl
其他相关命令
git stash list --stat
get stash show
如果你git隐藏pop(没有冲突),它将删除隐藏后,它被应用。但是如果你git stash apply,它将应用补丁而不从stash列表中删除它。然后你可以用git checkout - files…