本文介绍了为Git分支名称创建别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我在git中有以下分支:
Suppose I have the following branches in git:
-
master
-
release-2014-11-02-some-long-text
我想轻松地在这些对象之间切换,就像这样:
I would like to easily switch between those to, like this:
git checkout devel # checkout to master
git checkout release # checkout to the branch release currently points/aliases to, in this case: release-2014-11-02-some-long-text (I would like to change this alias from time to time)
如何在Git中做到这一点?
How can I do that in Git?
推荐答案
您可以尝试使用 git symbolic-ref
(如"中提到的那样,是否可以在Git中为分支添加别名?):
git symbolic-ref refs/heads/devel refs/heads/master
git symbolic-ref refs/heads/release refs/heads/release-2014-11-02-some-long-text
您可以在本要点中找到类似示例.
You can find a similar example in this gist.
这篇关于为Git分支名称创建别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!