# Reviewing changes

The Gitamic work area is divided into two main sections: **Unstaged** and **Staged**. You can see at a glance how many files are in each work area, so you can easily see where your attention is needed.

<figure><img src="https://1395355370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuLnmUGeKXyzgBElJTjcG%2Fuploads%2F7zabD2ebZAds6Oawtqs7%2FScreenshot%202023-09-04%20at%2022.25.32.png?alt=media&#x26;token=3fc19253-6ea4-4b59-81e0-5f59aa23beec" alt=""><figcaption><p>Wow! There are 4 changes already</p></figcaption></figure>

### Unstaged files

Start in the **Unstaged** tab. Here you can see all files with changes that Git has identified.

Clicking on a file's path in the list will open the Diff viewer, allowing you to see all of the unstaged changes made to each file. (If you have any *staged* changes in this file, you will need to view the file'ss diff from the **Staged** tab.)

You can stage one file at a time by clicking on the context menu to the right of each file (...) and selecting `Stage`.

<figure><img src="https://1395355370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuLnmUGeKXyzgBElJTjcG%2Fuploads%2F5FekmDOUrRzsqj7E3r02%2FScreenshot%202023-09-04%20at%2022.04.32.png?alt=media&#x26;token=5353b52c-9ccb-4834-945c-21838bb9f0cd" alt=""><figcaption><p>Click 'Staged' to mark all changes in this file as ready to be committed</p></figcaption></figure>

`Discard` erases the changes - so if the changes modify the file in any way, discarding them will reverse those changes: new content will be erased, deleted content will be restored.

You can stage many files at once using the bulk action checkboxes. Simply check one of the boxes to the left of each file and the bulk action options will appear at the top.

<figure><img src="https://1395355370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuLnmUGeKXyzgBElJTjcG%2Fuploads%2FhIx8DDmj1EQt1DA73ZEB%2FScreenshot%202023-09-04%20at%2022.06.39.png?alt=media&#x26;token=c1beea20-56b6-4fd0-9b61-395633ac9a76" alt=""><figcaption><p>Bulk actions make it easy to move through lots of changes rapidly</p></figcaption></figure>

It's useful to review the changes of each file and only stage what you know you want to commit. You can leave any changes that you don't want to commit in the *unstaged* state – Git will only commit changes that are *staged*.

### Staged files

In the **Staged** tab you can see all of the files with changes that you have *staged*, or marked as ready to be committed.

You can view the diffs of staged changes by clicking on the file path.

You can unstage a whole file from the context menu by clicking `Unstage`. These changes will now appear in the file's **Unstaged** view again.

You can bulk unstage many files at once.

### Viewing diffs

<figure><img src="https://1395355370-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuLnmUGeKXyzgBElJTjcG%2Fuploads%2FqJh9dJ537CmdQ618PcHK%2FScreenshot%202023-09-04%20at%2022.35.34.png?alt=media&#x26;token=52641b95-fa79-42a1-998d-5ad3f208466c" alt=""><figcaption><p>Gitamic's diff viewer is powerful ⚡️</p></figcaption></figure>

The **Diff viewer** is a critical part of reviewing changes made to your files. It shows you quickly what's changed and lets you decide which *parts* of a file you want to commit.

Let's break down the diff viewer.

When viewing diffs from files in the **Staged** or **Unstaged** tabs, you will see the changes for just *one file*. So you will see only one file card in the diff viewer, with the file name at the top of the card.

This also gives you a summary of the changes - an indicator of the type of change (the one above is an <mark style="background-color:green;">A</mark>ddition) and how many chunks have been detected. In this case, this whole file is new, so there's just one chunk.

It looks like a new entry in the `posts` collection!

Then there's the numbers in the left-hand column and the text on the right-hand side.

The numbers are the line numbers in the file. This can make it easier to find the changes in a code editor or other tools.

There are two banks of line numbers side-by-side: the left bank shows the numbers in the file *before* the change, the right shows the numbers *after* the change. In this example, there is no left bank as the file is completely new.

The diff viewer shows *blended* diffs where both versions of the file are shown together. This can sometimes be aid with spotting exactly what has changed in a specific chunk.

The text in the big right-hand column should be obvious: this is the contents of the file. Sometimes it will show the entire file. At other times it will show just some snippets of the file (called **Chunks**).

Each chunk is collapsible (useful when there are many chunks) and can be staged/unstaged independently of other changes. See [#patching-chunks](#patching-chunks "mention")for more.

You can use the `Context lines` setting to adjust how many lines of context are shown next to each chunk (click `Refresh` to see the change). Depending on the size of the file, this may affect the number of chunks.

#### Diffs

The diffs themselves are generally made up of three parts:

* **Old lines** show how the file appeared before any changes were made, according to Git's [#index](https://gitamic.simonhamp.me/git-basics#index "mention"). They appear in <mark style="background-color:red;">red</mark> and indicate that this line has changed or been removed entirely.
* **New lines** show the *current state of the file*. They appear in <mark style="background-color:green;">green</mark> and indicate that this line contains something new or different to what was there previously.
* **Context lines** may or may not appear depending on the state of the file – completely new files or deleted files won't have any context, for example, because the whole file has changed. When they do appear, they have the default background color.

You can `Stage all` or `Unstage all` (depending on where you viewed the diff from – the **Staged** or **Unstaged** tab), using the blue button at the top of the file card.

#### Patching chunks

With Gitamic, you can stage or unstage individual chunks. Simply use the `Stage` or `Unstage` button at the top-right of a chunk to move it from one part of the working tree to another.

Once a chunk's status has changed, it will disappear from the current view as you will be viewing a different context. For example, if you're viewing an unstaged file with 3 chunks and you stage one chunk, you will now see only 2 chunks.

This provides for a nice visual workflow.

When all chunks have been moved into the other context, the context will shift automatically to show you the fully staged or unstaged file and you should see all of the chunks re-appear.

{% hint style="warning" %}
**Remember:** *Everything* in a chunk gets staged or unstaged together. If you want to increase/decrease how much is included in a chunk, change the `Context lines` setting.
{% endhint %}

{% embed url="<https://youtu.be/b-c-q0LngMc>" %}
See chunk patching in action
{% endembed %}
