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