2. How to... : Review a Commit’s Files
   
Review a Commit’s Files
Use the Source Tree page to review the files -- new, deleted, or modified -- associated with a specific commit. Clicking a text file displays its contents in a file viewer. The contents of binary files (graphics and executables, for example) cannot be displayed.
The ability to view file contents can help developers troubleshoot problems. For example, imagine that a customer using version 6.2.1 of your software reports an error, referencing the following log message:
2014-07-07 17:27:47,858 ERROR LoginForm:83 gerrit.canonicalWebUrl must be set in gerrit.config
You could locate the v6.2.1 tag in the Source Tree page, navigate the directory path, and open LoginForm.java to view line 83.
The Source Tree page represents a snapshot of the repository at the time of the selected commit. Each row on the Source Tree page represents a directory or file in the source code. You can start from either the Commits or Source Tree page as described in the following sections.
Starting from the Commits Page
To review the files in a commit from the Commits page:
1. Click the Commits tab to display the Commits page.
The Repo and Branch fields retain their last values, even if they were set on the Source Tree or Branches pages.
2. Select the repository from the Repo drop-down menu.
If available, the master branch for the repository you choose is selected by default in the Branch field. Otherwise, GitCentric displays the first branch in the repository based on an alphanumeric sort.
3. Optionally, use the Branch drop-down menu to choose a branch other than Master or a tag.
Tip: The list in the drop-down menu includes only branches by default. You can also include (or restrict the list to) tags, which are often used to mark important milestones like release points (v2.0, for example). If you choose a tag, GitCentric changes the Branch icon and label to Tag: .
GitCentric refreshes the Commits page to update the starting point of the history. Each row represents a single commit, starting with the most recent. Scroll the page to reach the origin of the commit graph.
4. Locate the commit whose files you want to review and click the Source Tree link.
Tip: If you want to review the files for the first commit in the current branch or tag, click the Source Tree tab.
The Source Tree page appears. See Information Displayed on the Source Tree Page for more information.
5. Click the folders associated with the gravatar of the user whose commit you are reviewing. GitCentric updates the path displayed in Current Directory field as you navigate the source tree.
Tip: The name of this field changes to Current File when you select a file for viewing.
Starting from the Source Tree Page
To review the files in a commit from the Source Tree page:
1. Click the Source Tree tab to display the Source Tree page.
The Repo and Branch fields retain their last values, even if they were set on the Commits or Branches pages.
2. Select the repository from the Repo drop-down menu.
If available, the master branch for the repository you choose is selected by default in the Branch field. Otherwise, GitCentric displays the first branch in the repository based on an alphanumeric sort.
3. Optionally, use the Branch drop-down menu to choose a branch other than Master or a tag.
Tip: The list includes only branches by default. You can also include (or restrict the list to) tags, which are often used to mark important milestones like release points (v2.0, for example).
4. Click the folders associated with the gravatar of the user whose commit you are reviewing. GitCentric updates the path displayed in Current Directory field as you navigate the source tree.
Tip: The name of this field changes to Current File when you select a file for viewing.
Information Displayed on the Source Tree Page
As shown in this example, the Source Tree page provides several features that make it easy to locate new, deleted, and modified files in a commit:
 
Item
Feature
Description
A
Commit summary
The commit summary of the commit you selected on the Commits page is displayed at the top of the Source Tree page to provide context for the displayed source folders and files. It retains the features from the Commits page. See Information Displayed on the Commits Page for more information.
B
Navigation
Once on the Source Tree page, you navigate the tree by clicking folders you want to explore. Folders and their files are sorted in ascending alphabetical order. See Gravatars for navigation tips.
C
Source tree path
As you navigate the source tree, GitCentric displays the full path of the current directory.
D
Gravatars
You can use the author’s gravatar to quickly locate all files and directories that he or she was the last one to touch. The date next to the gravatar tells how recent the change was. If the author has registered with gravatar.com, his or her gravatar appears here; otherwise, a generic image is used.
E
File viewer
GitCentric displays text files in a viewer that replaces the main panel of the Source Tree page when you click the file. The contents of binary files (graphics and executables, for example) cannot be displayed.
To return to the previous view, you can use the browser’s back button, or you can click the desired directory in the Current File field.