You can just go a little lower-level, in a bare repo.
git branch
is willing to create a new branch in a bare repo. Just give it a commit to start from and you've made a new branch name pointing at an existing commit:
cd foo.git
git branch newbranch b6636ec88ba0750aec2706865653eb55031fb892
You can also use git update-ref
, which is even lower-level than git branch
and can create references outside of the refs/heads/
namespace:
git update-ref refs/special/ziggy b6636ec88ba0750aec2706865653eb55031fb892
git update-ref -d refs/special/delete
Edit: And, you can make indirect refs with git symbolic-ref
, e.g.:
git symbolic-ref MAGIC refs/tags/v1.3
(normally this would only be used to make HEAD
be a different indirect ref; the main point here is that this command, like git update-ref
, requires that you spell out the whole name-space name).