compat/fnmatch: update old-style definition to ANSI
[git/git.git] / Documentation / git-symbolic-ref.txt
1 git-symbolic-ref(1)
2 ===================
3
4 NAME
5 ----
6 git-symbolic-ref - Read and modify symbolic refs
7
8 SYNOPSIS
9 --------
10 [verse]
11 'git symbolic-ref' [-m <reason>] <name> <ref>
12 'git symbolic-ref' [-q] [--short] <name>
13
14 DESCRIPTION
15 -----------
16 Given one argument, reads which branch head the given symbolic
17 ref refers to and outputs its path, relative to the `.git/`
18 directory. Typically you would give `HEAD` as the <name>
19 argument to see which branch your working tree is on.
20
21 Given two arguments, creates or updates a symbolic ref <name> to
22 point at the given branch <ref>.
23
24 A symbolic ref is a regular file that stores a string that
25 begins with `ref: refs/`. For example, your `.git/HEAD` is
26 a regular file whose contents is `ref: refs/heads/master`.
27
28 OPTIONS
29 -------
30
31 -q::
32 --quiet::
33 Do not issue an error message if the <name> is not a
34 symbolic ref but a detached HEAD; instead exit with
35 non-zero status silently.
36
37 --short::
38 When showing the value of <name> as a symbolic ref, try to shorten the
39 value, e.g. from `refs/heads/master` to `master`.
40
41 -m::
42 Update the reflog for <name> with <reason>. This is valid only
43 when creating or updating a symbolic ref.
44
45 NOTES
46 -----
47 In the past, `.git/HEAD` was a symbolic link pointing at
48 `refs/heads/master`. When we wanted to switch to another branch,
49 we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we wanted
50 to find out which branch we are on, we did `readlink .git/HEAD`.
51 But symbolic links are not entirely portable, so they are now
52 deprecated and symbolic refs (as described above) are used by
53 default.
54
55 'git symbolic-ref' will exit with status 0 if the contents of the
56 symbolic ref were printed correctly, with status 1 if the requested
57 name is not a symbolic ref, or 128 if another error occurs.
58
59 GIT
60 ---
61 Part of the linkgit:git[1] suite