search

Home  >  Q&A  >  body text

php - After git commits forcefully, can the files in the remote warehouse be retrieved?

The remote warehouse is completely inconsistent with the local warehouse. I accidentally forced a submission. git push origin master -f was completely overwritten. Can I still roll back now?

phpcn_u1582phpcn_u15822762 days ago916

reply all(2)I'll reply

  • 为情所困

    为情所困2017-07-01 09:14:05

    After executing git reset, the contents in the .git/objects folder are not deleted accordingly.

    Run git reflog to find the previous commit ID (commit_id)

    Then git reset --hard commit_id

    reply
    0
  • 为情所困

    为情所困2017-07-01 09:14:05

    Yes, git reset --hard HEAD~1

    reply
    0
  • Cancelreply