Git tricks to be more productive

I like to use git command line. It is simple, it comes out of the box with many Linux distributions, it is IDE independent so you might be hacking in any language you like, you simply need to come there and push your changes. However, some day I found myself spending too much productive time in typing git commands, linking them to Jira tasks to make them more traceable and the usual thing that we developers need to do to get our work done and I decided to spend some time trying to improve that.

Here is what I did.

1. Shortcuts

Bash shortcuts for git is something I heard a long time ago and never tried. Now I can only recommend them. To get them ready I used this very practical post

Bash shortcuts are like small new commands that you declare to refer to more verbose ones. This can be done in the file that is executed at startup in your distribution ~/.bash_profile or ~/.bashrc so they are available in the next restart and always from command line.

There can be also functions which allow you to execute more logic than a simple command. I end up with this list in my file

2. Use jira command line

Another time consuming and distracting task was to go to Jira to get the number and name of the task I am working on every time I needed to do a commit. I use to do this to keep track of the task this commit is solving, and to benefit from the great capability all Atlasssian products have to be linked between them. The commit text might be stored in bash history and that’s fine but most of the time it is not and in your travel to the browser you can loose the focus of your current task.

To fix this the command line tool go-jira came very handy. It just ask you to define the basic config of your Jira server (url and user) in $home/.jira.d/config.yml a config file and then you just need to provide the password from the command line to get it going

After this you have a very long list of options to query task, dashboards and everything inside Jira, but to be honest I mostly use it with custom commands, which you can define in the config file and later call them as if they were a new options

and you end up with Issue id, summary, etc, ready to be piped into your next git command.

Software Engineer. Blockchain Enthusiast