Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

git pushed and merge to wrong branch on bitbucket

I did 2 git pushes to wrong branch on bitbucket. After that i did some merge while trying to fix this. Please help me I am in problems.

I have tree like this:

previos push 1 -> previous push 2 -> previous merge 1 -> unwanted push 1 -> unwanted push 2 -> unwanted merge

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I want development branch to come to state that was after "last previous wanter merge".
Tried some things like git reset –hard "last previous wanter merge commit hash", but it only puts me back on that state. But I am unable to push this to dev branch because andorid studio doesn’t recognize these changes in commit. Instead it offers me to do the git pull and return again to "unwanted merge" state. Please help

>Solution :

You have to issue:

git reset --hard <"previous pushes" commit hash>

# Check it if correct then, at your risk, ...

git push --force

NB: the hard reset must be issued onto the commit previous the wrong one.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading