I have a branch foo
in my local git repository.
I made a commit to this foo
.
I'm using emacs and magit to manage my git repository.
I pushed to my github repo, origin
but accidentally pushed to origin/master
rather than origin/foo
.
I want to move that commit to origin/foo
. Nothing about the local git repository needs to change, as it is correct, it is just the github version that is incorrect.
CodePudding user response:
From your comment, you now have foo
as remote tracking branch of origin/master
. You need to fix that to avoid future confusion: git checkout foo
, then git push --set-upstream origin foo
.
Then you need to reset master
on the remote repo. You do this by pushing your local master there. Since that would result in potentially losing data on the remote repo, git will complain. So you need to force it: git push -f origin master
.