You need these git aliases

Optimally we would always work in a purely linear way, after carefully planning all the code changes required to implement a certain feature. This works best if we are doing very small changes, modifying only a couple of characters or lines, if we are well acquainted with the codebase and the stack being used, or if we’re undertaking a trivial task that we can do almost mechanically. In this case we’re not going to put a lot of effort in keeping our git history clean, as the implementation itself will be clean.

But oftentimes we find ourselves working on unfamiliar code, with new tools or environments that we don’t yet master or simply working on a more explorative part of development. Whatever effort we put into planning, slicing and grooming a feature, there will be always place for entropy. It is in those cases when it can get messy.

a4f05c3 tying lerna publish again
4702697 oh god...
cf87a8a oh god...
6270624 fixing those bad yamls
d747eef fixing those yamls -\_-
6944908 fixing those yamls again again
4702697 fixing those yamls again
5840248 fixing those yamls
255f280 testing global instalation of lerna on merge

As unavoidable as this kind of git history is, we don’t have to show this ugliness to owr reviewers. Not only to give the appearance of an organized developer but also to make Code Reviews easier. Pull Requests should be easy to review, and to do so it should be taken into account that:

  • Changes in a commit should be easy to express in a sentence (git message length?)
  • There shouldn’t be superfluous commits
  • Implementation, refactoring, style changes should never be in the same commit
  • Everything that belongs together should be in the same commit

Arlo’s commit notation helps separate more implementation, refactoring, environment commits by using prefixes like F and B for feature and bugfix and r, e, c for refactoring, environment, comments commits. This also guides the reviewer where the more sensible changes happen.

In this series I want to share some of the git aliases that I regularly use to clean after my mess and try to give my reviewers an easier time.

This entry is part of the Useful Git Aliases series.