Can a symbolic-ref in git reference the current upstream branch? -
i can git:
echo "ref: head" > .git/h
and can use “h” in place of head in every place accepts commit-ish, e.g. git log h
or git show-branch h origin/master
.
is possible same upstream branch of head? represented @{u}
(or head@{upstream}
in long form), git log @{u}
, git rebase --onto @{u}
or git show-branch head @{u}
.
trying put of these symbolic-ref this:
echo "ref: head@{upstream}" > .git/u
will result in error:
$ git show u warning: ignoring dangling symref u. warning: ignoring dangling symref u. fatal: ambiguous argument 'u': unknown revision or path not in working tree. use '--' separate paths revisions, this: 'git <command> [<revision>...] -- [<file>...]'
don't that; use git symbolic-ref
create symbolic references. instance, git symbolic-ref u head
"correct" command create .git/u
symbolic reference head
(which in turn symbolic reference current branch, unless head
detached).
as things work now, though, can't make symbolic reference point requires additional parsing. has name of reference, git can resolve easily, without of fancy "peeling" process git rev-parse
performs on user-supplied names (including names indirect, head
). because symbolic references of orphan step-child, saying goes: they've had enough work put in them make them work head
contain branch-name, little additional work.
Comments
Post a Comment