GIT restore last detached HEAD

前端 未结 7 1780
醉梦人生
醉梦人生 2020-12-07 12:06

Please, I have a big problem in my project: this is the scenario. I have an xcode project under GIT. Today I realized that the last commit broke some tests, so i checked out

7条回答
  •  温柔的废话
    2020-12-07 12:37

    In Sourcetree, you can do this using the GUI.

    First find the "lost" commit by looking for a message in the Command History (view:Show Command Output). It will probably be in the command "Switching Branch" after the commit that you lost. In that message, hopefully you'll see the commit comment with a 1234567 commit ID.

    Take that Commit ID to next step.

    Hit the "Branch" button in the top toolbar and you should get a dialog "New Branch" where you can specify a certain commit. Put that Commit ID in there, specify a new branch name, hit Create Branch and you should get a new branch with your lost commit!

提交回复
热议问题