Tag: url

How to use Git.io to shorten GitHub URLs and create vanity URLs – 049

Suppose you want to shorten the URL to a particular location on GitHub. Or perhaps you want to create a vanity URL that goes directly to your GitHub profile, e.g. https://git.io/saraford. You can use Git.io: GitHub URL Shortener.

To shorten a URL, open your favorite command prompt (via Git Shell) and type in

$  curl -i https://git.io -F "url=https://github.com/saraford/your-moment-of-github-zen/issues"

in the response, you’ll see your shorten URL!

Location: https://git.io/vMdeF

To create a vanity URL for your GitHub profile,

$ curl -i https://git.io -F "url=https://github.com/saraford" -F "code=saraford"

in the response, you’ll see a new way to refer to your GitHub profile!

Location: https://git.io/saraford

How to link directly to a line of code in a file hosted on GitHub – 043

It’s a lot easier to point someone directly to a line of code you’re referring to, rather than sending them the link to a file with a message “and now scroll to line 74.”

First, you’ll navigate to a file hosted on GitHub. It could be a file you’ve checked in or any random file in any random repo.

Next, click on the line number that you want to get a link to. In today’s example, you’ll see me refer to one of my sample Electron apps where I forgot to remove the line that shows developer tools for debugging.

Clicking line number in a file on GitHub.com

And volia, check your web browser address bar. You now have a URL for that exact line of code, e.g.  https://github.com/saraford/your-moment-of-github-zen/blob/master/main.js#L74

When you send this link to someone else, the line of code will open around the middle of the screen with the yellow highlight.