码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-03-26 21:15:35      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:opera   res   split   spl   comm   only   change   his   add new   

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

标签:opera   res   split   spl   comm   only   change   his   add new   

原文地址:https://www.cnblogs.com/Answer1215/p/10603398.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!