Print custom messages after executing git commands

Wanna have fun while coding? then this post is for you!

I wrote this tool called amusing_git which prints jokes when you run specific git commands. e.g when you push or pull the code from github repo, you will see some hilarious messages. Another good thing about this tool is you can add your own messages to the list.

Demo

How to install amusing_git?

amusing_git is a rubygem. It can be installed by running the below command.

Tell amusing_git to amuse

Once you install amusing_git, run below command to see the list of options it provides.

This command will show all the available features.

To start amusement for a specific git repository follow the below steps:

  1. Go to the git repo
  2. Run amusing_git start

Thats it, now when you pull or push code to github, amusing_git will amuse you. To stop amusing_git for a repo, just run amusing_git stop in the same repo.

Want to print jokes in your own scripts?

amusing_git is flexible enough to be used anywhere. If you want to make your own script funny just execute below command in your script and amusing_git will take care of the rest.

amusing_git configuration

amusing_git stores all the configuration in ~/.amusing_git directory. This directory contains two files:

  1. config
  2. default_messages.

default_messages is just a text files which contains all the default messages provided by amusing_git.

The config files contains the actual configuration of the plugin. Here is how it looks.

You can configure the git hooks on which amusing_git amuses you. If you already are already using git hooks for some other purpose then don’t worry, amusing_git will not override your configuration. It will just add another command to the same hook.

Also you can give your own messages file so that next time when amusing_git runs it considers the newly configured file.

Want to make amusing_git better?

Its an open source project. You can contribute to it on github. All contributions are welcome ­čÖé

Thats all I had, thank you very much for reading. If you like the tool don’t forget to it a star on github.

 

About Ajit Singh

Hi, I am Ajit Singh, author of singhajit.com. I work on a lot of different technologies and tools. I started my career as a software engineer in Chennai (India) and recently I moved to Gurgaon near to my home town. I like reading and writing about technology.

Leave a Reply

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