How to rollback everything to previous commit

后端 未结 2 470
情话喂你
情话喂你 2021-01-30 16:28

Recently in a project with multiple people, a commit was made as seen in the image below. Marked in red you can see a commit with the description/comment of \'Merge?\'.

相关标签:
2条回答
  • 2021-01-30 16:36

    I searched for multiple options to get my git reset to specific commit, but most of them aren't so satisfactory.

    I generally use this to reset the git to the specific commit in source tree.

    1. select commit to reset on sourcetree.

    2. In dropdowns select the active branch , first Parent Only

    3. And right click on "Reset branch to this commit" and select hard reset option (soft, mixed and hard)

    4. and then go to terminal git push -f

    You should be all set!

    0 讨论(0)
  • 2021-01-30 16:44

    If you have pushed the commits upstream...

    Select the commit you would like to roll back to and reverse the changes by clicking Reverse File, Reverse Hunk or Reverse Selected Lines. Do this for all the commits after the commit you would like to roll back to also.

    reverse stuff reverse commit

    If you have not pushed the commits upstream...

    Right click on the commit and click on Reset current branch to this commit.

    reset branch to commit

    0 讨论(0)
提交回复
热议问题