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

前端 未结 4 2017
时光说笑
时光说笑 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:26

    You have a small co-located team, so communication isn't a problem. Make the commit history look as it should have looked:

    git branch -f develop dab4896
    git branch newfeature 8c29252
    git push -f origin develop newfeature
    

    and have everyone refetch. You're done.

    This kind of mistake is one of the reasons to rewrite.

提交回复
热议问题