git: Roll back multiple commits at once

Description:

Independent and decentralized commits roll back together

        git revert -n sha-1 (sha-1 value corresponding to a single git commit) sha-1 sha-1 ...

        ps: -n means that no new commit will be generated. If you want to generate a commit directly, please remove -n

 

The most recent consecutive coomit rolls back together

        git revert -n HEAD~5..HEAD~2

        The above example rolls back the third commit of the current branch to the sixth commit (counting from 0, 0 represents the current commit, usually not written)

Guess you like

Origin blog.csdn.net/qq1090504117/article/details/111469783