Press "Enter" to skip to content

Getting more productive in the command line

I mentioned previously that I changed my Android Studio terminal to Bash.

Since doing that, I’ve been working on making my console more productive as well.

I’ve done 3 main things:

  • Set up a gem to allow me to create pull requests from my terminal
  • Set up some aliases for Bash
  • Set up a ton of aliases for Git

Create pull requests from the terminal:

We use an Atlassian tool chain and part of our process is that everything gets peer reviewed and merged to our main branches through pull requests.

This meant that I had to leave the terminal to create a PR after I pushed code. This will not do! So it made sense to install a tool to do that from the terminal. Atlassian has a good blog post on doing that here:

This was before Atlassian added default reviewers, and having to add my 6 team members every time I had to create a PR was a big part of the reason I went down this rabbit hole. So there was one more thing missing: How do I add the reviewers?

The answer ended up being a function in my Bash config:

function pr() { 
	stash pull-request origin/$1 @RIAAN

This allows me to create a pull request to origin/develop with myself as a reviewer by simply typing: pr develop

Bash setup:

Other than the pr() function in my bash config, I also alias ‘git’ to ‘g’. It might seem a bit silly, but I type git a lot, and I hate typing… It looks like this:

alias g='git'
source /usr/share/bash-completion/completions/git
__git_complete g __git_main

So, the alias bit is obvious. The rest is there so that you can still auto-complete branch names and git commands on ‘tab’.

I keep my config in a gist at:

Git aliases:

I keep a copy of my git config here:

This has been built up from contributions by co-workers, podcast hosts and various random things I found on the internet.

Bonus: Install Cmder

When I’m not in the IDE, my terminal of choice is Cmder

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *