git: revert back to a specific version








  • Command 1: Revert back to previous version(Note: substitute to your commit hash.):
    git reset --hard 76f134a2692c9472af3227d2f9fdb50548de6c0c
    git clean -f # clean up local repository
    git push -f # push back to central repository
  • Command 2: The following command reverts everything from the HEAD back to the commit hash:
    git revert --no-commit 76f134a2692c9472af3227d2f9fdb50548de6c0c..HEAD

see also




No comments:

Post a Comment