0

im stuck at an assignment where im required to do a 'without fast forward' merge with my branch back to my master. Reason being, i accidentally did a normal merge and pushed to my remote repo. How do i reverse this and do it correctly? i tried

 git reset --hard <commit> 

to go back to previous commit followed by

git merge --no-ff <branch name>, 

but it says 'Already up to date' does it mean now i have done it correctly? Please advice... thank you!

kopion
  • 1
  • 1

1 Answers1

0

You did not do it right. Because you already pushed your 'normal merge' to your remote repo, and you have already lost your branch topology (this could be why you want to do a --no-ff merge at the beginning). It says up to date is probably because you don't have any local changes.

git merge --no-ff branch is the right command, but before this, you need to revert both your local AND remote repository.

git reset --hard commit can be used to reset your local repo.

Reset your remote repository is a bit more involved: and there are many information available, for example this answer shows if you accept to keep your commit history, and this answer tells you how to keep no traces of the undo.

Booo
  • 493
  • 3
  • 13