6 git-symbolic-ref - Read, modify and delete symbolic refs
11 'git symbolic-ref' [-m <reason>] <name> <ref>
12 'git symbolic-ref' [-q] [--short] <name>
13 'git symbolic-ref' --delete [-q] <name>
17 Given one argument, reads which branch head the given symbolic
18 ref refers to and outputs its path, relative to the `.git/`
19 directory. Typically you would give `HEAD` as the <name>
20 argument to see which branch your working tree is on.
22 Given two arguments, creates or updates a symbolic ref <name> to
23 point at the given branch <ref>.
25 Given `--delete` and an additional argument, deletes the given
28 A symbolic ref is a regular file that stores a string that
29 begins with `ref: refs/`. For example, your `.git/HEAD` is
30 a regular file whose contents is `ref: refs/heads/master`.
37 Delete the symbolic ref <name>.
41 Do not issue an error message if the <name> is not a
42 symbolic ref but a detached HEAD; instead exit with
43 non-zero status silently.
46 When showing the value of <name> as a symbolic ref, try to shorten the
47 value, e.g. from `refs/heads/master` to `master`.
50 Update the reflog for <name> with <reason>. This is valid only
51 when creating or updating a symbolic ref.
55 In the past, `.git/HEAD` was a symbolic link pointing at
56 `refs/heads/master`. When we wanted to switch to another branch,
57 we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we wanted
58 to find out which branch we are on, we did `readlink .git/HEAD`.
59 But symbolic links are not entirely portable, so they are now
60 deprecated and symbolic refs (as described above) are used by
63 'git symbolic-ref' will exit with status 0 if the contents of the
64 symbolic ref were printed correctly, with status 1 if the requested
65 name is not a symbolic ref, or 128 if another error occurs.
69 Part of the linkgit:git[1] suite