Initially, I mistakenly checkout the wrong branch of a project using git. I thought this was an easy fix, but I think I checked out the correct remote branch to new local branch. Oops. Now when I try to push my changes to the remote branch, git says I pushing a new remote branch, which is not what I would like.
How do I get my changed merged onto the correct remote/local branch so that I can commit/push to the correct remote branch?
I think I should rebase, but I want to ask the wisdom of the crowd before I break something else.
You can always "copy" a commit from one branch to another, by doing cherry-pick.
Start with git fetch
, to update your DB, then checkout the remote branch. You'll be seeing a snapshot of the remote branch, in detached mode.
Now do git cherry-pick [commit]
(replace with commit ID), resolve any conflict if needed, then push.