Cancel Last Commit When Already push

 


This how I cancel last commit when it already push on gitlab, there a couple solution but this work for me , and follow this step for fixing.

First Step

Reset to <commit id> what you want to be last commit example: 
[feature] commit what you want to remove 3x311x8x
[feature] commit must be the last bx3x2x8x
.
.
.

$ git reset — hard <commit-id>
example:

$ git reset --hard b3ee42c8
HEAD is now at b3
ee42c8 [last]

Second Step

clean your local drive in project
$ git clean -f -d

Third Step

$ git status

Forth Step

$ git fetch — all

Fifth Step

add + (plus) before your branch
$ git push -u origin +<branch-name>
example:

$ git push -u origin +feature/parent


No comments: