I have updated both the git pr and gh aliases to be more succinct and work better with the different ways that you can clone git repos.
At RightScale we use git as our version control system. On the whole it’s pretty great, but there are always ways to improve tooling. I have included a few useful tricks.
Command line tricks
If you’re anything like me you are constantly jumping between branches.
cd - allows you to move back to your previous directory. You can use
git co - command in a similar way to navigate back to your previous branch.
So if I was on the master branch and moved to another branch, I can navigate back very easily.
Git aliases are increadibly powerful. They act like regular aliases that you would set up in your
.bash_profile but they always run under the
git namespace and can be configured on a per repository basis.
I have a few pretty basic aliases setup that are nothing special. (More info on aliases ).
On the left is the alias and on the right is the command that it actually runs.
Now some more interesting aliases.
These aliases are all using
git rev-parse --abbrev-ref HEAD to work out the name of the branch. It then uses this to push/pull or set upstream. (This will only work if you are working with a branch named the same locally and remotely)
git pr is one of the most useful aliases I use. It opens a compare view (on GitHub) between
master and your current branch. So if I was on
temp_branch it would open a comparison between
In GitHub markdown you can create task lists.
If you embed this task list in the initial comment section of your PR then it can be seen on the GitHub pull request page
Replying to comments
You can quote a particular part of a comment in a reply by highlighting it and pressing