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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:35:29  来源:igfitidea点击:

How to unsquash a commit?

git

提问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 reflogto browse all the commits that existed! Or since you have the commit hash you could just do a git checkout 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2and see the commit itself..

你可以git reflog用来浏览所有存在的提交!或者因为你有提交哈希,你可以做一个git checkout 93ebc467ff512580ae3c5a76790f09dfd5e3e6f2并查看提交本身..