1GIT-SYMBOLIC-REF(1) Git Manual GIT-SYMBOLIC-REF(1)
2
3
4
6 git-symbolic-ref - Read and modify symbolic refs
7
9 git-symbolic-ref [-q] [-m <reason>] <name> [<ref>]
10
12 Given one argument, reads which branch head the given symbolic ref
13 refers to and outputs its path, relative to the .git/ directory.
14 Typically you would give HEAD as the <name> argument to see on which
15 branch your working tree is on.
16
17 Give two arguments, create or update a symbolic ref <name> to point at
18 the given branch <ref>.
19
20 A symbolic ref is a regular file that stores a string that begins with
21 ref: refs/. For example, your .git/HEAD is a regular file whose
22 contents is ref: refs/heads/master.
23
25 -q
26 Do not issue an error message if the <name> is not a symbolic ref
27 but a detached HEAD; instead exit with non-zero status silently.
28
29 -m
30 Update the reflog for <name> with <reason>. This is valid only when
31 creating or updating a symbolic ref.
32
34 In the past, .git/HEAD was a symbolic link pointing at
35 refs/heads/master. When we wanted to switch to another branch, we did
36 ln -sf refs/heads/newbranch .git/HEAD, and when we wanted to find out
37 which branch we are on, we did readlink .git/HEAD. This was fine, and
38 internally that is what still happens by default, but on platforms that
39 do not have working symlinks, or that do not have the readlink(1)
40 command, this was a bit cumbersome. On some platforms, ln -sf does not
41 even work as advertised (horrors). Therefore symbolic links are now
42 deprecated and symbolic refs are used by default.
43
44 git-symbolic-ref will exit with status 0 if the contents of the
45 symbolic ref were printed correctly, with status 1 if the requested
46 name is not a symbolic ref, or 128 if another error occurs.
47
49 Written by Junio C Hamano <junkio@cox.net>
50
52 Part of the git(7) suite
53
54
55
56
57Git 1.5.3.3 10/09/2007 GIT-SYMBOLIC-REF(1)