Archive

Uncategorized

If your project consists of several developers working on different features your git log will probably look like this at some point:

screenshot_2

You may find the dev branch in there but it requires some thorough reading. In fact, it reminds me of something;

guitar-hero-slider-notes

Look ! Someone has made a Guitar Hero challenge of your git repository !

Introducing git rebase

Whilst not appropriate in any situation, git rebase command can greatly improve the readability of the repository.

Instead of merging and keeping the timeline from the earliest commit you branched off rebase fast forwards your changes to HEAD of your branch. This image has the same operations as the first image in this post, the difference is that before merging to dev I have performed a rebase on the dev branch.

Before merging the feature branches I performed a rebase on the dev branch and then merged my changes.

screenshot_2-oes

The dev branch (now called dev_with_rebase) is hopefully a bit easier to spot now.

It is important to know that git rebase can only be used on local branches as it rewrites the history of that branch. If parts of the branch has been merged or branched by other developers you will most likely have to apologise to them when you rewrite their history and ruin their changes.

The repository used in this showcase is located at https://github.com/oskaremil/git-ar-hero

Advertisement