AzureWorld
AzureWorld

Reputation: 311

Deleting a merge from History Git

I'm trying to figure out how to fix a merge problem me and my team are facing. I'm working on this project at school, and my team has made a lot of progress, but one of the team members who didn't know what he was doing force merges his code into the master branch. His branch is like 2 days old and we've already implemented a lot of new functionality since time, his branch is probably 20 or so commits away from head. I've tried rolling back to a stable master branch but his branch is intermingled with the stable so I can't seem to retrieve the stable back. Any suggestions? we are fairly new to git, but that person had no idea what was going on and just force merged his code without resolving the commits.

Upvotes: 1

Views: 23

Answers (1)

CodeWizard
CodeWizard

Reputation: 142552

Go and sit on his computer. Type git reflog, it will show you the full commit history (as well as other things). Find out the last good commit id , check it out git checkout SHA-1. create branch at this point and commit it back again. Once you are on the right commit your repository will "get back" to the last good place.

Another option is to perform a git bisect and to find out what is the bad commit.

Click here for blog about reflog

Click here for blog about bisect

Good luck.

Upvotes: 1

Related Questions