3

I am new to Gitlab. We work on local branches in GIT and then push the changes before it get's merged to Master.

So I was trying to rollback a commit. But I somehow messed up and ended up bringing my colleagues commit's into my local branch.

Now I am trying to go back to previous version in Gitlab.
If you see the attached image, I am currently in the latest version but I want to go back to version 9. Is there anyway I can do this ?

GitLab

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Rishabh Jain
  • 33
  • 1
  • 5
  • You need to _revert_ that unwanted merge commit. [See here](https://stackoverflow.com/questions/7099833/how-to-revert-a-merge-commit-thats-already-pushed-to-remote-branch) for a general answer; not sure of the exact steps in GitLab. – Tim Biegeleisen Aug 10 '20 at 03:53

1 Answers1

1

On GitLab Web UI itself, the revert operation is documented here

https://docs.gitlab.com/ee/user/project/merge_requests/img/cherry_pick_changes_commit.png

The alternative would be to locally reset your branch to HEAD~ and force push, which can work if you are the only one using this branch.
But reverting is safer, and only add a new commit (instead of overriding the recent branch history). That new commit will cancel the changes done in the commit you are reverting.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250