How to undo a push or merge with Git?

I still remember the time when I was trying to update my local branch using eclipse and suddenly the message “There are conflicts” appeared in front of my eyes. At that point in my career, fixing merge conflicts was a terrifying experience. I was not sure if what I was doing — which is supposed to be a fix — is correct or wrong. But I was not alone.

Merging and branching have been considered a bit scary in the classic subversion world. With Git things changed. These practices became simple and parts of our daily coding workflow. To feel more fluent and familiarized with them, all you need is to understand Git workflow and the feature branching concept.

_“The core idea behind the Feature Branch Workflow is that all feature development should take place in a dedicated branch instead of the _master_ branch. This concept makes it easy for multiple developers to work on a particular feature without disturbing the main codebase. It also means the _master_ branch will never contain broken code.” — _Atlassian

But what should you do if you have accidentally pushed or merged broken code into a branch that is used by all your team(s) members?

Don’t worry, in your real life you cannot turn back time but in the Git subversion system, you can. In this post, we will see how to do it.

#startup #programming #git #devops

Oops, You Have Accidentally Merged Into The Wrong Branch. What Should You Do?
1.70 GEEK