问题
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)
How can I do that in Git?
回答1:
You can try using git symbolic-ref (as mentioned in "Is it possible to alias a branch in 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.
来源:https://stackoverflow.com/questions/26944235/creating-aliases-for-git-branch-names