Sometimes you find yourself in a really big mess:
- you made some modification that you want to disregard, but
- you don’t want to delete everything you’ve done.
- you messed up your master. Although you shouldn’t.
That’s why a git reset is not the way to go, however there is a really nice way to do it:
- you choose the commit where you want to restart
- you apply the merge with ‘theirs’ strategy, which actually copy the info from branch B (theirs) to branch A
This is the magic trick:
[code]git checkout -b fixing some_commit
git checkout master
git merge -s recursive –strategy-option theirs B[/code]
- Create a fixing branch from the right commit
- go back to master
- scrap everything you did and copy from the good old branch.
Leave a Reply
You must be logged in to post a comment.