Contract Work

Monday, May 12, 2014

Setting up Aliases

For months and months I’ve heard people talk about setting up aliases and profiles and all these custom configs for their computers. I’ve done some basic googling but have stayed away from setting things up because I hadn’t found any simple, easy posts and I had this vision that this whole “set up” thing was super complicated. Guess what? It’s actually ridiculously simple. This is what I get for being too embarrassed to ask about something for an extended period of time.

What are aliases? Aliases are basically shortcuts for things you type all the time. The same way that hotkeys work to open up programs and execute certain actions you find yourself constantly using, aliases do that for your terminal.

The best place to start is to think about what you type all the time. For me, I type “git status” over a dozen times a day, so that was aliased to gs. Chris suggested that I set up an alias to open my bash_profile file so that I can quickly add more aliases as I discover what I type the most. As I mentioned, doing this is super easy.

1. Open up your bash_profile file
2. Set up your aliases by typing alias gs=“git status”

As you see, the left of the = is what you want the shortcut to be and the right of it is what the shortcut stands for. Once you’re got all your aliases in, quit terminal and reopen it to start using them.

Besides aliases, I also learned from JP about using homebrew more effectively. Homebrew is a package manager and with homebrew you can add different packages including git bash completion which allows you to tab to complete things like git branch names and more.

The final piece of this setup is naming your computer. Apparently this is a thing. I’ve got my Disney princess naming convention for my servers so now I need one for my computer(s). I’ve decided on 80’s cartoons starting with the very-applicable “penny”. I look forward to naming future computers Brain, Jem, and, I’m sure, a number of CareBears.

Here's a good article for additional reading on setting up git aliases:

No comments:

Post a Comment