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

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

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

标签:base   ora   first   tran   commit   ase   safe   col   and   

If we pushed our changes already to the remote repository we have to pay attention to not change the git history (using commands like rebase, reset, amend etc). Other collaborators of the same repository might already have pulled your changes, thus resulting into horrible, strange merge conflicts if we change the git history. There are some “safer commands” for undoing in such cases.

 

If you push something we shouldn‘t push to git, we can revert it:

First, using git log to get the commit id you want to revert, then using:

git revert <commit_id>

Then push to git

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

标签:base   ora   first   tran   commit   ase   safe   col   and   

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

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