Today I Learned

A Hashrocket project

Ready to join Hashrocket? Find Openings here and apply today.

Alias a Git Branch Name 🏷

I’m working on a long-running Git branch with a long name, and I’d like to have an alias for that long branch name. The best solution I’ve found so far is to use a Git symbolic ref:

$ git symbolic-ref refs/heads/epic refs/heads/long-epic-branch-name

Once in place, this alias can be used to reference the longer branch name:

$ git checkout epic
Switched to branch 'epic'
$ git branch --show-current
long-epic-branch-name

Resources:

git-symbolic-refs
Answer: Creating aliases for Git branch names