Tuesday, 13 August 2013

Git checkout a commit and attach to existing branch

Git checkout a commit and attach to existing branch

I have a local repo and I want to fast-forward it to a specific commit
(which may not be the HEAD of the remote repo).
So I do: git fetch master git checkout sha
This however puts me in a detached HEAD state, which I don't want. Is
there an equivalent to git checkout -b branch_name sha, which works when
branch_name already exist?
In short, I have to update the HEAD of my local repo to a remote commit. I
already tried git pull sha and git pull origin sha with no success.

No comments:

Post a Comment