Skip to content

Category: Tools

Quick git tips: cleaning the repository

“sweep it under what?” by psyberartist is licensed under CC BY 2.0

Intro

git is great, and its documentation is no exception. By simply reading the Git Book, one can get quite proficient on git, thanks to the good balance between theory and examples.

However, most times I found myself learning git the harder way, using Google and Stackoverflow and looking for very little and specific pieces of information. While this is great for solving daily problems, it does not really provide the best learning experience. To achieve that, it is necessary to go to the aforementioned Git Book.

In addition to that, the book is filled with very useful commands which can significantly improve your workflow. They are simple, and once you learn them, you will wonder what has been going on with your life before that moment.

I present this blog entry as a way to summarize and collect those commands. Today, we will talk about cleaning the git repository.

Anyway, forget about this blog and go read the Git Book.

More stuff that you need: tig

https://ccsearch.creativecommons.org/image/detail/eREIabAmtmbyI8VwjeQTTA==
“Control board” by Ben Townsend (CC BY 2.0)

We all know it: the git command line tool is extremly powerful, and chances are that you will not need any other tool for doing the job. However, it is true that performing some tasks, like navigating the repository history, is more intuitive using software such as Gitkraken or even gitk.

Instead of selling your soul and embracing unholy tools like those, it is possible to use tig, a command line tool based on ncurses (so it is not simply text-based, including quasi-graphical elements).

Stuff that you need: Vim + fzf

Files
“Files” by Indi Samarajiva (CC BY 2.0)

I would like to share a quick tip which can highly improve your workflow (at least it did with mine). If you usually work with the command line, you might have experienced that it is sometimes difficult to remember where is a certain file located. You might have some idea of which directory it was it in, but you might not even remember exactly the file name. For sure, tools like find can help you, but they are not as fast and convenient to do as one might like.

If you have ever felt like this, you need fzf.