direktori cari
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
watak

命名

git-symbolic-ref  - 读取,修改和删除符号引用

概要

git symbolic-ref [-m <reason>] <name> <ref>git symbolic-ref [-q] [--short] <name>git symbolic-ref --delete [-q] <name>

描述

给定一个参数,读取哪个分支头部给定的符号ref引用并输出其相对于.git/目录的路径。通常,您会HEAD以<name>参数的形式提供您的工作树所在的分支。

给定两个参数,创建或更新符号ref <name>以指向给定分支<ref>。

给定--delete和额外的参数,删除给定的符号参考。

符号ref是一个常规文件,它存储了一个以字符串开头的字符串ref: refs/。例如,你.git/HEAD的内容是一个普通文件ref: refs/heads/master

选项

-d   --delete

删除符号ref <名称>。

-q   --quiet

如果<name>不是符号引用,而是分离的HEAD,则不要发出错误消息; 而是静静地退出非零状态。

--short

当示出了作为一个符号REF <名称>的值,尽量缩短值,例如从refs/heads/mastermaster

-m

使用<reason>更新<名称>的reflog。这仅在创建或更新符号引用时有效。

注意

过去,这.git/HEAD是一个象征性的链接refs/heads/master。当我们想切换到另一个分支时,我们做了ln -sf refs/heads/newbranch .git/HEAD,当我们想知道我们在哪个分支时,我们做到了readlink .git/HEAD。但符号链接不是完全可移植的,因此它们现在已被弃用,并且默认情况下使用符号引用(如上所述)。

如果符号ref的内容打印正确,git symbolic-ref将以状态0退出,如果请求的名称不是符号参考,则为状态1;如果发生另一错误,则为128。

Artikel sebelumnya: Artikel seterusnya: