Files
tldr/pages.zh/common/git-symbolic-ref.md

24 lines
663 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# git symbolic-ref
> 读取、改变或删除存储引用的文件。
> 更多信息:<https://git-scm.com/docs/git-symbolic-ref>。
- 通过名称存储引用:
`git symbolic-ref refs/{{name}} {{ref}}`
- 通过名称存储引用,包括更新原因的消息:
`git symbolic-ref -m "{{message}}" refs/{{name}} refs/heads/{{branch_name}}`
- 通过名称读取引用:
`git symbolic-ref refs/{{name}}`
- 通过名称删除引用:
`git symbolic-ref --delete refs/{{name}}`
- 对于脚本,使用 `--quiet` 隐藏错误,并使用 `--short` 简化输出“refs/heads/X” 输出为 “X”
`git symbolic-ref --quiet --short refs/{{name}}`