Undo a "merge branch master" to my "current branch"

3

I am working with a branch B and I have the branch Master . I just finished my modifications and I wanted to add them to the Master, but instead of doing this I made a merge branch 'Master' into 'B' (I put it in English because I do not know how to translate it and why I'm using gitHubDesktop ).

I did the commit without solving the problems thinking that I could go back to the previous one and everything would be fine but now I have a lot of conflicts in my source code. Try to go back to the commit before the merge but the changes remain. How can I go back to this commit without the Merge I made of the master?

    
asked by Angel 04.11.2017 в 00:52
source

1 answer

4

You can see all the states with the git reflog command the result will be a list of states with the first column being the code for their respective state.

Then with the command git reset --hard {poner codigo de la lista} you can return to the state you want.

for example, to return to the HEAD @ {2} state the command would be:

git reset --hard fbebd80

Note : to know what state to go to, you can base yourself on the comment in the last column

Another alternative solution would be to save to a draft, cleaning the current branch with the command git stash save

    
answered by 04.11.2017 / 00:57
source