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. go to git history you can check in your github/gitlab etc.
There are several other ways but this is the way I’ve tried and it works. this in stackoverflow use “git revert” and check this link https://stackoverflow.com/a/22683231/8366535.
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 b3ee42c8 [last]
Second Step
clean your local drive in project, explanation of this code
(-f) force
(-d) drive
$ git clean -f -d
Third Step
Check status your git , response must be like this:
“nothing to commit, working tree clean”
$ git status
Fourth Step
add + (plus) before your branch
$ git push -u origin +<branch-name>
example:
$ git push -u origin +feature/parent