[Git] Undo my last commit and split it into two separate ones

Posted answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Git] Undo my last commit and split it into two separate ones相关的知识,希望对你有一定的参考价值。

When you accidentally committed some changes to your branch you have various possibilities to “undo” that operation and add some more changes. One is to use git amend to change the commit message or add new files. But what we want to take out all of the committed changes again and maybe even split them into separate commits. Let’s see how we can achieve that. Note: This only holds if you did not yet push your changes to the remote repository.

 

In this case, what we can do is first do the reset:

git reset HEAD~

 

Then spreate files into diifferent commit messages.

以上是关于[Git] Undo my last commit and split it into two separate ones的主要内容,如果未能解决你的问题,请参考以下文章

[GitHub]How to undo the most recent commits in Git?

[Git] Undo a commit that has already been pushed to the remote repository

你可以在 git commit 期间更改文件内容吗?

oracle体系-10-undo

oracle redo undo

sh pop last commit