Reverting a series of pushed merges and commits in Git (without rewriting history)

前端 未结 4 2086
时光说笑
时光说笑 2021-02-01 16:36

Context

One of my teammates mistakenly pushed some commits to our main development branch. We\'re a small, collocated team. Our remote repository is hosted on an inter

4条回答
  •  天命终不由人
    2021-02-01 17:34

    What you are trying to do is very risky.

    indeed you can revert and delete the commits that you have already pushed to the repo but if someone has already pulled your changes and he has the commitId that you are going to delete, the repo can become "unstable" and git will not be able to handle the pull and pushes since you deleted commit that is now removed from the history.

    Do this (revert and delete commit ) only and only if no one has pull this commit yet.

提交回复
热议问题