Git:Cherry-Pick 到工作副本而不提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32333383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git: Cherry-Pick to working copy without commit
提问by schoetbi
I have several branches where I keep certain commits that I want to apply to my working copy every now and then. Initially I tried cherry-picking but I do not want to have the commit in the target branch later.
我有几个分支,我保留某些提交,我想时不时将这些提交应用于我的工作副本。最初我尝试挑选樱桃,但我不想稍后在目标分支中提交。
So I did cherry-pick
+ reset HEAD~1 --soft
所以我做了cherry-pick
+reset HEAD~1 --soft
Is there something simpler like cherry-picking to working copy only?
有没有更简单的东西,比如只从工作副本中挑选樱桃?
回答by Igal S.
Use '-n' flag with the cherry-picking which is "no commit"
将“-n”标志与“无提交”的樱桃采摘一起使用
See here: http://git-scm.com/docs/git-cherry-pick
见这里:http: //git-scm.com/docs/git-cherry-pick
git cherry-pick -n <HASH>
回答by Ravinda lakshan
If you are using Terminal
如果您使用终端
git cherry-pick -n <HASH>
If you are using Intellij Idea
如果您使用的是 Intellij Idea
Settings -> Version Control -> git
untick commit automatically on cherry-pick
回答by rofrol
I was getting errors that error: server/metadata/metadata-preui-prod.xml: No such file or directory
我收到的错误是 error: server/metadata/metadata-preui-prod.xml: No such file or directory
So now I do this
所以现在我这样做
git checkout SHA -- server/metadata && git reset -- server/met
adata
git checkout SHA -- server/metadata && git reset -- server/met
adata
Old
老的
git show SHA -- file1.txt file2.txt | git apply -
git show SHA -- file1.txt file2.txt | git apply -
or all files from SHA
或来自 SHA 的所有文件
git show SHA | git apply -
git show SHA | git apply -