Skip to content
Download

Changes and commits

The Git view, on the right, holds your changed files and the box to commit them.
Its title says where you are, such as Changes · on main, and ends with Recent actions; see Undo.

Your changed files

The Git view sorts your files into three groups, each with how many it holds:

The Git view with two changed files under Changes, Stage all, and the commit message boxThe Git view with two changed files under Changes, Stage all, and the commit message box

GroupHolds
ConflictsFiles a merge, rebase, cherry-pick or revert left in conflict. Choose one to resolve it; see Resolve conflicts.
StagedWhat your next commit takes.
ChangesWhat you changed and haven't staged yet, new files included.

With nothing changed, it says No changes.
A group shows its first files, then and five more; choose that to see them all.

Each file shows how many lines it adds and removes, and a letter for what happened to it:

LetterMeans
MChanged
AAdded
DDeleted
RRenamed
CCopied
TIts type changed, such as a file that became a link
UNew, and not tracked by Git yet
!In conflict

Show files as, on each group, lays them out as a Tree, in Folders (the default) or as a List.

Commitline follows changes you make anywhere, in your editor or a terminal, and shows them as they happen.

Stage

  • Stage on a file stages all of its changes; Stage all on the Changes group stages every file.
  • Unstage and Unstage all, on Staged, take them back out.

To stage only part of a file:

  1. Choose Show the diff on the file.
  2. Choose Stage hunk on a block of changes to stage that block.
  3. Or click the lines you want, added or removed: the button then reads Stage 2 lines, and stages only those.

In the Staged group, the same buttons unstage: Unstage hunk and Unstage 2 lines.
Wrap lines on an open diff wraps its long lines.

Large diffs are cut short, at 1 MiB for one file or 4 MiB in all, and say The diff is cut short here.
A binary file says Binary file: no lines to show.

Commit

  1. Stage what you want in the commit.
  2. Type a message in Commit message.
  3. Choose Commit 3 files.

The commit uses your own Git: your name and email, your hooks, and your signing.
When Git signs your commits, the box says so, such as Signed with SSH key.

Commit stays off until there's a message, something staged, and no conflict left.

Commit and push

When your branch has a remote branch, Commit and push commits, then pushes, in one go.
See Fetch, pull and push.

Amend the last commit

Tick Amend the last commit to change the last commit instead of making a new one.
The box fills with its message; edit it if you like, stage anything else it should take, and choose Amend commit.

You can amend only a commit you haven't pushed yet.
When there's none, or it's already on your remote branch, the tick box is off, and its tooltip says why.
It's off during a merge, rebase, cherry-pick or revert, too.

The Git view with Amend the last commit ticked: the last commit's message in the box, and Amend commitThe Git view with Amend the last commit ticked: the last commit's message in the box, and Amend commit

Take a commit back

  • Undo commit, on History's toolbar, takes back the last commit and keeps its changes staged.
    Commitline says no, and why, for a commit that's already pushed, and for a branch's first commit.
  • Or press Ctrl+Z (⌘Z on a Mac) outside any text box; see Undo.

The pull request and checks

When your remote is on GitHub or Azure DevOps and you're signed in, a row in the Git view shows your branch's pull request and its checks.
See GitHub and Azure DevOps.

On any other server, the row says it's a plain Git server, with no pull requests or checks to show.
Everything else works as usual.