Viewing File Status of a Repository
This article should help users to understand the File Status view in SourceTree, and the different statuses that a file may have.
To view the File Status of a repository:
1. For Windows:
- Users can navigate to the File Status window through the File Status tab way below.
- Users can also alternatively press CTRL+1, or navigate it through View > File Status View.
2. For Mac:
- Users can navigate to the log/history window by clicking the -shaped icon button at the top-left section.
- Users can also alternatively press Command+1, or navigate it through View > File Status View.
Or, users can just click on File Status > Working Copy on the left sidebar.
Here's how a File Status window looks like:
The numbers in the list below correlates with the numbers in the screenshot above:
By performing operations via Git in SourceTree, users will see different states that may occur to a file:
#1 This state icon appears when a file is modified and tracked.
#2 This state icon appears when a file is deleted from the repository
#3 This state icon appears when the repository tracks a new file, and as of now is untracked.
#4 This state icon appears when a file is updated (latest changes committed)
Here's the state of all the four files via git status through the terminal:
#5 If users would like to stage the files, they can:
- Click the checkbox beside a file to stage that particular file.
- Click the "Stage hunk" button to stage that particular file.
- Click the checkbox beside "Unstaged files" to stage all the files in one go.
The staged files will then move from the "Unstaged files" section to the "Staged files" section.
The sign occurs when a new file is staged.
Here's the state of the files via git status through the terminal when the files are staged:
#6 To discard changes/modification done in a file and revert it back to how it was during the last commit update, simply click on Discard Hunk.
#7 Users can choose to display files that are in a certain specific status, and choose to sort files in a certain format:
Users can also manipulate how SourceTree will display the transition of a file between Unstaged and Staged. Here are the options:
If you would like to learn more about the states of a file that can occur in git, please do check out this link: