Tower Icon

Staging Changes

Understanding Git's "Staging Area" concept and how it's implemented in Tower will help you create better commits.

The "Staging Area"

Git has the unique concept of the Staging Area. Whereas in other version control systems you might have to commit every changed file, in Git you can determine which of the current changes you have made shall go into the next commit.

The Staging Area (also called the "index") is where Git remembers which changes are marked to be committed. If a change is not "staged" it will not be committed. A change can be as granular as a single changed line in a file, leading to very precise commits. If, after staging a change, you decide you don't want that change to go into the next commit, you can also "unstage" it.

On the command line the "git add" command is used to stage a file.

Staging changes with Tower

In Tower, staging changes is done in the Status view. In the Status view you are looking at your current working directory files that can have changes and are available for staging.

You can quickly determine if a file is staged or not by looking at the "Staged" and "Status" columns:

To stage / unstage a complete file

Staging or unstaging files completely can be done by clicking the checkbox in the "Staged" column of the file list. Right clicking an item also allows you to stage / unstage via the contextual menu.

If you quickly want to stage all files at once you can do so by clicking the "Stage All" button.

To stage / unstage only parts of a file

In Tower you can also stage or unstage only parts or even a single line of a file.

  1. Select a file with changes from the list.

  2. In the details area, switch to "unstaged" mode if you want to stage individual changes or to "staged" mode if you want to unstage modifications that were already staged.

  3. If you move your mouse over a "chunk" (a changed part in the diff display of the details area) you can choose to stage / unstage this chunk.

  4. If you select a specific line you can choose to stage / unstage the single line.

REMEMBER:Staged changes (be it complete files or only individual changes inside a file) will be included in the next commit while unstaged changes are disregarded (and could be committed later, after being staged).


Related Topics

Overview of the Status area

Committing changes

Undoing changes