When I have a detached HEAD that's several commits ahead of an existing branch, what's the right command(s) to advance that branch to the detached HEAD without changing anything in my working directory?
Context: I just ran git rebase --onto mybranch SHA1 SHA2, and now I've got a detached HEAD at REBASED-SHA2. Now I want to advance mybranch to REBASED-SHA2. I could create a new branch at REBASED-SHA2 (git checkout -b temp), delete the old branch (git branch -d mybranch), and rename the new branch (git branch -m temp mybranch). But that's a lot of typing, and might require even more typing if I had to set up tracking to the remote mybranch.
Is there a shorter way to do what I want, which is just to "advance" mybranch to a later commit?
git checkout -B mybranchmoves themybranchtip label to (or creates it at) your current checkout, because since no specific target commit was given@akaHEADis the default.