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