Git Cheat Sheet

By Greg Rowe | July 18, 2017

Git is a wonderful tool but it isn’t always user friendly nor obvious. For certain tasks, like deleting a remote tag, I find myself turning to Google. It’s not obvious how to delete a remote tag and it’s not easy to remember either. Deleting remote tags is also something that isn’t done frequently. Instead of using Google every time this situation arises I added a “cheat” alias.

Before you point out that I could create an alias with an easy to remember name that’s not necessarily true. There are situations where you can’t write an alias that achieves what you need. I won’t be surprised if the alias functionality improves over time but, as it stands now, there are certain things that I don’t think you can accomplish with an alias.

The multi-line feature for aliases makes it easy to create a cheat sheet. Now I run git cheat instead of turning to Google whenever I run into a situation that I can’t remember.

[alias]
	cheat = ! "\
	echo Delete remote tag: ;\
	echo		git tag -d TAGNAME ;\
	echo		git push origin :refs/tags/TAGNAME ;\
	echo Delete remote branch: ;\
	echo     git push origin --delete BRANCH_NAME ;\
	echo ;"
comments powered by Disqus