Chunk & Line Staging

The ability to stage and discard individual chunks and lines is a powerful way to create really precise commits.

Transcript
Chunk & Line Staging

In version control, a very important rule is to create granular and semantically correct commits. This is why we often want to be able to stage and discard changes on a chunk level, or even a line level.

Let’s take a look at how to do that in Tower.

You have two levels of granularity to work with changes, the first being the chunk level. Here is an example: we can choose to stage or discard a whole chunk, just by clicking on the “Stage Chunk” or “Discard Chunk” button in the changeset view.

Or, we can go a level deeper. Let’s say we want to stage just these 2 lines but not the other ones. To do that, we can just select the lines in the lines numbers column and select “Stage Lines”. Then only these lines will be part of our next commit.
Of course, we can also choose to discard lines the same way, by selecting “Discard Lines”.

As you can see, the ability to stage and discard chunks and lines is a powerful way to deal with your changes, and ultimately, to create really precise commits.