Delete last commit in bitbucket

后端 未结 9 1325
隐瞒了意图╮
隐瞒了意图╮ 2020-12-12 10:17

I made a mistake and I don\'t know how to delete my latest push in the repository. I pull the latest updates of the app but it has conflicts and I push it to repository.

9条回答
  •  天命终不由人
    2020-12-12 11:01

    I've had trouble with git revert in the past (mainly because I'm not quite certain how it works.) I've had trouble reverting because of merge problems..

    My simple solution is this.

    Step 1.

     git clone  .
    

    your project in another folder, then:

    Step 2.

    git reset --hard 
    

    then Step 3.

    in your latest (and main) project dir (the one that has the problematic last commit) paste the files of step 2

    Step 4.

    git commit -m "Fixing the previous messy commit" 
    

    Step 5.

    Enjoy

提交回复
热议问题