[Git] Undo a commit that has already been pushed to the remote repository
Posted answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Git] Undo a commit that has already been pushed to the remote repository相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章
[GitHub]How to undo the most recent commits in Git?
[Git] Undo my last commit and split it into two separate ones