Rolling back a remote Git repository

前端 未结 4 1489
谎友^
谎友^ 2020-11-29 15:58

I have a remote Git repository, and I need to roll back the last n commits into cold oblivion.

4条回答
  •  青春惊慌失措
    2020-11-29 16:32

    Fortunately I was in a position to use Pat Notz's solution which completely removed the unwanted commit. However, initially I got the error

    error: failed to push some refs to 'ssh://git@gitrepo.git'
    To prevent you from losing history, non-fast-forward updates were rejected*
    

    But adding the force (-f) option overwrite this error

    git push -f origin 52e36b294e:master
    

提交回复
热议问题