Skip to content

Instantly share code, notes, and snippets.

@jlengstorf
Last active March 21, 2018 13:36
Show Gist options
  • Save jlengstorf/508d5d115c1a0965df78a7874c3de9ac to your computer and use it in GitHub Desktop.
Save jlengstorf/508d5d115c1a0965df78a7874c3de9ac to your computer and use it in GitHub Desktop.
Create custom git.io short links by adding this helper function to your `.bash_profile`

Create Custom git.io Short Links

Add this helper function to your ~/.bash_profile (or ~/.bashrc, or whatever you use) to create custom short links for your GitHub projects without having to remember the whole cURL command!

Installation

If you use a file other than ~/.bash_profile to configure your terminal, substitute that value in the installation instructions below.

  1. Open your ~/.bash_profile
  2. Copy-paste the gitlink function into it
  3. Save the file
  4. Run source ~/.bash_profile

Usage

To create a git.io short link:

gitlink $url_to_shorten [$custom_short_code]

$ gitlink https://github.com/gramps-graphql
# => https://git.io/vxnTa

To specify a custom short link:

$ gitlink https://github.com/jlengstorf/bemmit bemmit
# => https://git.io/bemmit

NOTE: Custom short links can only be assigned if A) no short link has already been created for the long URL and B) the custom short link is not already in use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment