I did this (on my production server):
$ git branch
* master
$ git fetch staging
$ git checkout staging/stage1
Now I want the master branch to point to HEAD which is a SHA-1 hash. I also want the master reflog updated.
how can I do that?
EDIT:
To clarify what I mean by “reflog”: I want $GIT_DIR/logs/refs/heads/master to have one more line added to it when I’m done. That is, I want to change master branch, and then have master@{1} point to exactly where master branch just was. So yes, I am referring to something which is repo specific. I want to be able to undo this ref change somehow if I need to.
I would just do echo .git/refs/remotes/staging/stage1 > .git/refs/heads/master and that would change the master branch to exactly where I want it, but .git/logs folder wouldn’t be updated.
git update-ref refs/heads/master HEADis the command I need.I also apparently need to fully type out the branch names because it looks like update-ref isn’t smart enough to “resolve” it’s arguments. Meaning, typing “master” as an argument will have git create a branch at .git/master instead of knowing that I mean “refs/heads/master”.
This will update the log…
(taken from http://csurs.csr.uky.edu/cgi-bin/man/man2html?1+git-update-ref)