search

Home  >  Q&A  >  body text

How to roll back when git push goes wrong

If other code was mistakenly submitted to the master branch, how to roll back the master branch online to its previous code?

PHPzPHPz2753 days ago1492

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-17 10:04:51

    Revert to the previous version first:
    git reset --hard HEAD^

    Then force push the current version to the cloud:
    git push origin HEAD --force

    reply
    0
  • Cancelreply