Sounds like you committed some things on top of the wrong branch? Ok..... it's not that difficult.
Checkout local feature branch. Cherry-pick the changes that you committed on top of master. Say, it's the last 2 commits then git cherry-pick master~2..master
. Then push your local feature to remote feature. Then redirect master pointer to the right position git branch -f master master~2
. Then push to master with the right position: git push -f whatever-remote master
. That should do.
Original Response to Original Question
I guess you have a local branch for this problem, right? The branch that you pushed into master by mistake. Let's call it branch-a
git push whatever-remote branch-a # if you want the remote branch to be called branch-a as well
git push whatever correct-revision-id:master # revert master to where it was
That should suffice.
feature
branch but pushed the branch to remote repo withgit push origin feature:master
?