Set Branch Alias with Git

By  on  

Version control systems can be difficult to use, especially when you don't use a UI app. Just think about main branch or revision names: svn uses "trunk", git uses "master", and mercurial (hg) uses "tip". I need to switch between mercurial and git frequently, so I end up reversing command and branch names constantly.

To set a git branch alias, execute the following:

# alias -> real branch
git symbolic-ref refs/heads/trunk refs/heads/master

With the alias in place, you can execute commands like:

git checkout trunk
git branch # * master

Not only can you create git aliases for commands, but you can create aliases for branches!

Recent Features

Incredible Demos

  • By
    Simple Image Lazy Load and Fade

    One of the quickest and easiest website performance optimizations is decreasing image loading.  That means a variety of things, including minifying images with tools like ImageOptim and TinyPNG, using data URIs and sprites, and lazy loading images.  It's a bit jarring when you're lazy loading images and they just...

  • By
    prefers-color-scheme: CSS Media Query

    One device and app feature I've come to appreciate is the ability to change between light and dark modes. If you've ever done late night coding or reading, you know how amazing a dark theme can be for preventing eye strain and the headaches that result.

Discussion

  1. Michael

    Any idea how to do this in a Bitbucket repository? Can I push this symbolic refs somehow?

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!