Rolling back a remote Git repository

前端 未结 4 1460
谎友^
谎友^ 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:23

    elmarco is correct... his suggestion is the best for shared/public repositories (or, at least public branches). If it wasn't shared (or you're willing to disrupt others) you can also push a particular ref:

    git push origin old_master:master
    

    Or, if there's a particular commit SHA1 (say 1e4f99e in abbreviated form) you'd like to move back to:

    git push origin 1e4f99e:master
    

提交回复
热议问题