git delete bad commit

Method:

    git reset --hard <commit_id>

    git push origin HEAD --force



Others:

    According to --soft --mixed --hard, the working tree, index and HEAD will be reset:
    git reset --mixed: This is the default method, not git reset with any parameters, even in this way, it rolls back to a certain version, only keeps the source code, rolls back the commit and index information
    git reset –soft: rolls back to a certain version, only rolls back the commit information, Will not restore to the index file level. If you still want to submit, you can directly commit to
    git reset –hard: completely roll back to a certain version, and the local source code will also become the content of the previous version


    HEAD Last commit
    HEAD^ Last
    <commit_id> SHA1 of each commit Value. Can be seen with git log, or found in the commit tab on the page.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325411602&siteId=291194637
Recommended