Home > Software design >  git pushed and merge to wrong branch on bitbucket
git pushed and merge to wrong branch on bitbucket

Time:07-08

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

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

CodePudding user response:

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.

  • Related