Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-symbolic-ref(1) |
| 2 | =================== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 6 | git-symbolic-ref - Read and modify symbolic refs |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
Junio C Hamano | 16cf158 | 2007-02-05 07:21:48 | [diff] [blame] | 10 | 'git-symbolic-ref' [-q] [-m <reason>] <name> [<ref>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 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 | |
Junio C Hamano | 735a4f7 | 2006-12-03 01:53:32 | [diff] [blame] | 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 | |
Junio C Hamano | 97c11c5 | 2007-01-16 10:44:47 | [diff] [blame] | 26 | OPTIONS |
| 27 | ------- |
| 28 | |
Junio C Hamano | 7ae0ab2 | 2007-11-03 02:46:46 | [diff] [blame] | 29 | -q, --quiet:: |
Junio C Hamano | 97c11c5 | 2007-01-16 10:44:47 | [diff] [blame] | 30 | Do not issue an error message if the <name> is not a |
| 31 | symbolic ref but a detached HEAD; instead exit with |
| 32 | non-zero status silently. |
| 33 | |
Junio C Hamano | 16cf158 | 2007-02-05 07:21:48 | [diff] [blame] | 34 | -m:: |
| 35 | Update the reflog for <name> with <reason>. This is valid only |
| 36 | when creating or updating a symbolic ref. |
| 37 | |
Junio C Hamano | 735a4f7 | 2006-12-03 01:53:32 | [diff] [blame] | 38 | NOTES |
| 39 | ----- |
| 40 | In the past, `.git/HEAD` was a symbolic link pointing at |
| 41 | `refs/heads/master`. When we wanted to switch to another branch, |
| 42 | we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we wanted |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 43 | to find out which branch we are on, we did `readlink .git/HEAD`. |
| 44 | This was fine, and internally that is what still happens by |
| 45 | default, but on platforms that do not have working symlinks, |
| 46 | or that do not have the `readlink(1)` command, this was a bit |
| 47 | cumbersome. On some platforms, `ln -sf` does not even work as |
Junio C Hamano | 735a4f7 | 2006-12-03 01:53:32 | [diff] [blame] | 48 | advertised (horrors). Therefore symbolic links are now deprecated |
| 49 | and symbolic refs are used by default. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 50 | |
Junio C Hamano | 97c11c5 | 2007-01-16 10:44:47 | [diff] [blame] | 51 | git-symbolic-ref will exit with status 0 if the contents of the |
| 52 | symbolic ref were printed correctly, with status 1 if the requested |
| 53 | name is not a symbolic ref, or 128 if another error occurs. |
| 54 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 55 | Author |
| 56 | ------ |
| 57 | Written by Junio C Hamano <junkio@cox.net> |
| 58 | |
| 59 | GIT |
| 60 | --- |
| 61 | Part of the gitlink:git[7] suite |