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.
From your comment, you now have
fooas remote tracking branch oforigin/master. You need to fix that to avoid future confusion:git checkout foo, thengit push --set-upstream origin foo.Then you need to reset
masteron 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.