Enhance your git commands with ASCII Art ☜(˚▽˚)☞

Stefan Natter 🇦🇹👨🏻‍💻 - Jul 9 '20 - - Dev Community

If you like this article, chances are you will like my tweets or newsletters too. If you are curious, have a look at my twitter profile. 🚀

It is a great feeling when you push your work into a git repository, isn't it? 🚀 But what if you could enhance this emotion with a tiny extra? Something that makes you smile 😁 every time you execute the command? Something your teammates will ask you how you did it.

Let me show you, how you can add ASCII art to your git commands and turning the "boring" response into an interesting one.

Alt Text

In the image above you see my alias gpu for the git command git push. The ASCII art of a balloon appears every time I push my code to a remote branch. Isn't that awesome?!

Setup

In just a few moments you have your very own ASCII art attached to a git or any other bash command.

Step 1 - Find an ASCII art

Choose an image (e.g. asciiart.eu) or text (e.g. patorjk.com/software/taag/). There are plenty of other websites on the internet helping you creating your ASCII art. It is up to you.

Step 2 - Save the ASCII art

Once you found the one you like, save it in a txt file. I have the balloon in a file called git_push.txt in my home directory, for instance.

Step 3 - Create an alias

Now open your .bash_profile, .zshrc (or .aliases if you use this dotfile template) and add the following line:

alias gpu='echo ""; cat ~/push.txt; git push; echo "";'
Enter fullscreen mode Exit fullscreen mode

Make sure the path to your push.txt is correct.

Step 4 - Enjoy

Either restart your Terminal or source the changed file, before executing gpu.

source ~/.bash_profile
gpu
Enter fullscreen mode Exit fullscreen mode

That's it! 🎉 You should now see your ASCII art.


Repeat Step 1 - 3 for any command you would like to enhance and personalize (here's a gist you can bookmark)! Let me know in the comments below how your ASCII arts look like. I am always looking for new inspirations.

👋🏻
Stefan

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .