首页 > 其他 > 详细

[Git] Undo a Commit that has Already Been Pushed

时间:2020-01-09 16:33:16      阅读:60      评论:0      收藏:0      [点我收藏+]

Once a commit is pushed, you do NOT want to use git reset to undo it - because reset will rewrite the history tree, and anyone who has already pulled that branch will have a bad tree.

Instead, we‘ll use git revert to make a "revert commit" (like a merge commit), which will "undo" a specific commit. So the syntax is:

git revert [HASH-TO-UNDO]

git log --oneline

     f23481b (HEAD -> master, origin/master, origin/HEAD) take 3

 

git revert f23481b

 

[Git] Undo a Commit that has Already Been Pushed

原文:https://www.cnblogs.com/Answer1215/p/12171563.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!