File-Management Operations

When you work with files in the Git Panel, you can perform some operations directly from there, even at the individual file level.

The following image shows the options available to you based on a file's status:
Description of git-panel-extra.png follows
Description of the illustration git-panel-extra.png

Action Steps
Open Right-click an untracked or a changed file and select Open to view the file in the corresponding visual editor. For example, opening the main-start-page.json will show the main-start page in the JSON editor.
Add Right-click an untracked or a changed file and select Add to mark the file for inclusion in your next commit to the current branch. You can also click the Add All link to add all unstaged files (both untracked and modified files that haven't yet been committed), or to select the files you want to add.

After an untracked file has been added, it'll move from the Untracked category to the Changed category.

Commit Right-click an untracked or a changed file and select Commit, enter a message, and click Commit to commit the file to your current branch. You can also click the Commit All link next to Changed to group and commit multiple changed files.
Rollback File Right-click a changed file and select Rollback File, then confirm to revert modifications made to the file since its last commit to the current branch. This option is available only for a file with changes that have been committed to the branch. You won't see this option when your workspace is in an interrupted state (for example, when conflicts occur during Merge or Pull operations).
Delete Right-click an untracked or a changed file and select Delete to remove the file. Deleting a untracked file removes it from your next commit, but deleting a changed file removes a file that was previously committed to your branch.
Ignore Right-click an untracked file and select Ignore to exclude a file from being tracked. Typically, you do this for generated files that you don't want to be tracked in Git. Ignoring a file removes it from the Untracked category and adds a .gitignore file in the Changed category.

If you want to start tracking an ignored file, double-click the .gitignore file to open it, then delete the file's entry from the list:
Description of gitignore.png follows
Description of the illustration gitignore.png

Compare with HEAD Right-click a changed file and select Compare with HEAD to compare the file's changes in your workspace with the latest on the current branch in the repo (known as HEAD in Git terms). When you compare a file with HEAD, you are comparing changes you've made to the file but not yet committed with the commit at the very tip of the current branch.

You won't see this option for non-text files or files with conflicts (conflicts can occur during Merge or Pull operations).

Compare with Revision Right-click a changed file and select Compare with Revision to compare the file's changes with a revision. You won't see this option for non-text files or files with conflicts (conflicts can occur during Merge or Pull operations).

You can compare a file against a revision, a branch, or between two revisions:

  • Use Revision to compare the file with a revision on the current branch (default) or on another branch. Use search to find a revision by its ID, especially if it might be in another branch (see Get the Revision ID of a Commit).
  • Use Different Branch to compare the file's changes with the tip of another branch, local or remote.
  • Use Between Two Revisions to compare any two revisions of the file on the current branch.
Blank When you compare a file, you'll see a read-only view of the file's changes in a diff viewer. The diff view will automatically refresh if the file's content changes.

Use the options in the toolbar to view revision information, navigate between changes, and change how the output is displayed:
Icon Description
Previous change icon Navigate to previous change in diff view
Next change icon Navigate to next change in diff view
Show inline icon Show diff view inline
Show side-by-side icon Show diff view side by side