git 如何取消压缩提交?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16931746/
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
How to unsquash a commit?
提问by cmouse
I have squashed 40 commmits at some point in time, and would like to pick back one commit. Is there some way to do this? I have the commit ref (93ebc467ff512580ae3c5a76790f09dfd5e3e6f2) that I would like to unsquash.
我在某个时间点压缩了 40 次提交,并且想重新选择一次提交。有没有办法做到这一点?我有我想取消压缩的提交参考(93ebc467ff512580ae3c5a76790f09dfd5e3e6f2)。
采纳答案by Johan Lundberg
You can add the patch representing that commit onto the top of the branch you are on by doing
您可以通过执行将表示该提交的补丁添加到您所在分支的顶部
git cherry-pick 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2
回答by Gaurav Agarwal
You could use git reflog
to browse all the commits that existed! Or since you have the commit hash you could just do a git checkout 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2
and see the commit itself..
你可以git reflog
用来浏览所有存在的提交!或者因为你有提交哈希,你可以做一个git checkout 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2
并查看提交本身..