syntagma
syntagma

Reputation: 24294

Creating aliases for Git branch names

Suppose I have the following branches in git:

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?

Upvotes: 13

Views: 3937

Answers (1)

VonC
VonC

Reputation: 1323343

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.

Upvotes: 17

Related Questions