The core Git workflow in VS Code lives in the Source Control view. You stage files, write commit messages, push to the remote, and pull from teammates there.
Everything works through the interface. You do not need terminal commands, though the integrated terminal is always available if you prefer it.
This article assumes you already have a repository open. If you need to set one up first, read /vscode/how-to-initialize-a-git-repository-and-publish-it-to-github-from-vs-code or /vscode/how-to-clone-a-github-repository-in-vs-code.
Understand the Source Control view
Open the Source Control view by pressing Ctrl+Shift+G (Windows/Linux) or by selecting the branch icon in the Activity Bar.
The view has three main sections:
| Section | What it shows |
|---|---|
| Message box | A text input at the top for typing commit messages. |
| Changes | Files you have modified or created but have not staged yet. Each file shows a letter: M (modified), U (untracked/new), or D (deleted). |
| Staged Changes | Files that are staged and ready to be committed. Appears only after you stage at least one file. |
Below these sections, the view shows the Source Control Graph (a visual commit history) and the ellipsis menu (...) for additional commands like Pull, Push, Fetch, and Branch operations.
Stage changes
Staging tells Git which changes you want to include in the next commit. You can stage individual files, all changes at once, or even specific lines within a file.
Stage a single file
Hover over a file in the Changes list and select the + (plus) icon that appears. The file moves to the Staged Changes section.
Stage all changes at once
Hover over the Changes section header and select the + (Stage All Changes) button.
Stage specific lines
Open a changed file to see the diff editor.
Colored markers in the gutter show added (green), modified (blue), and deleted (red) lines.
Hover near a changed line and select Stage Selected Ranges. Only those lines stage.
To unstage a file, hover over it in the Staged Changes list and select the - (minus) icon. The file moves back to Changes without losing your edits.
Review changes before committing
Before you commit, it is a good habit to review what you changed. Select any file in the Changes or Staged Changes list to open the diff editor.
The diff editor shows the old version on the left and the new version on the right (side-by-side mode on wider windows). Changed lines are highlighted: green for additions, red for deletions, and blue for modifications. You can scroll through the entire file to review every difference.
If you have a Copilot subscription, select the Code Review button in the Source Control view toolbar to get AI-generated review comments on your changes before you commit.
Commit changes
A commit saves your staged changes to the local Git history. It does not send anything to GitHub yet.
Write a commit message
Type your message in the text box at the top of the Source Control view, above the Changes section. A good commit message is short (under 72 characters for the first line) and describes what changed and why.
If you have a Copilot subscription, select the sparkle icon in the message box to generate a message based on your staged changes.
Commit
Select the Commit button, or press Ctrl+Enter (Windows/Linux) or Cmd+Enter (macOS) while the message box is focused.
The staged changes clear from the view, and your commit is saved locally. The Status Bar updates to show any outgoing commits (↑).
After committing, the Source Control view may show a Sync Changes button if your branch has a remote. If you see a Publish Branch button instead, you have not connected this branch to a remote yet.
Push changes to the remote
Pushing uploads your local commits to the remote repository (for example, GitHub). Other team members can then pull your changes.
You have three ways to push:
| Method | How |
|---|---|
| Sync Changes button | Select Sync Changes in the Source Control view. This pulls first, then pushes. Recommended for daily use. |
| Status Bar sync icon | Select the sync icon (rotating arrows) in the Status Bar, next to the branch name. Same as Sync Changes. |
| Push only | Select the ... (ellipsis) menu in the Source Control view, then Push. This does not pull first. |
If this is the first push for a new branch, VS Code prompts you to publish the branch. This sets the upstream branch on the remote and pushes your commits. After that, future pushes use the Sync Changes button normally.
Pull changes from the remote
Pulling downloads commits from the remote repository that other people (or you, from another machine) have pushed. You should pull before you start working and before you push.
| Method | How |
|---|---|
| Sync Changes button | Select Sync Changes. Pulls remote commits first, then pushes yours. |
| Pull only | Select the ... (ellipsis) menu in the Source Control view, then Pull. |
The Status Bar shows a sync status indicator next to the branch name. ↑2 ↓1 means you have 2 local commits to push and 1 remote commit to pull. Select the sync icon to resolve both.
The Sync Changes workflow
For everyday work, Sync Changes is the simplest approach. It handles pull and push in one action. Make changes, save your files, stage what you want, write a commit message, select Commit, then select Sync Changes to pull remote updates and push your commit.
If a teammate pushed changes to the same branch while you were working, Sync Changes pulls those changes first. If Git can merge them automatically, your commit goes on top and everything pushes cleanly.
If there is a conflict, VS Code opens the merge editor and helps you resolve it. Learn more in /vscode/how-to-resolve-git-merge-conflicts-with-the-vs-code-merge-editor.
View commit history
To see the history of commits on your branch, open the Source Control Graph by selecting the graph icon in the Source Control view toolbar. The graph shows:
- Your current branch highlighted
- Commit messages and authors
- Incoming commits (↓) from the remote
- Outgoing commits (↑) that have not been pushed
Select any commit in the graph to see which files were changed.
Undo or discard changes
| Action | How |
|---|---|
| Unstage a file | Hover over the file in Staged Changes and select - (minus). |
| Discard changes to a file | Right-click the file in Changes and select Discard Changes. This permanently reverts the file to the last committed state. |
| Undo the last commit | Open the Command Palette and run Git: Undo Last Commit. The changes from that commit move back to Staged Changes. |
Discarding changes is permanent. If you are not sure whether you might need the changes later, stash them instead. Open the Command Palette, run Git: Stash, and your changes are saved and can be restored later.
Once you are comfortable with the basic commit workflow, explore /vscode/how-to-create-switch-and-merge-git-branches-in-vs-code to start working on features in separate branches.
Rune AI
Key Insights
- Stage files by selecting the + next to each file or the + on the Changes header to stage everything.
- Write a meaningful commit message and select Commit to save the change to local history.
- Use Sync Changes to pull remote commits and push your local commits in one click.
- The Status Bar sync indicator (↑/↓ numbers) shows how many commits are out of sync.
- Use the Source Control Graph to view your commit history at any time.
- Discard uncommitted changes by right-clicking a file in the Changes list and selecting Discard Changes.
Frequently Asked Questions
What is the difference between Commit, Push, and Sync?
How do I undo a commit in VS Code?
Can I stage only part of a file instead of the whole file?
What does the ↑2 ↓1 indicator mean in the Status Bar?
Conclusion
The daily Git workflow in VS Code is: edit files, review changes in the Source Control view, stage what you want to commit, write a message, commit, and sync. The Status Bar shows you at a glance whether your local branch is ahead of or behind the remote.
More in this topic
How to Use VS Code with WSL 2 on Windows
Run VS Code connected to Windows Subsystem for Linux so you can develop in a full Linux environment with native tools, terminals, and debugging, all from Windows.
20 Best VS Code Extensions for Web Developers in 2026
Twenty carefully chosen VS Code extensions every web developer should know. Covers formatting, linting, frameworks, debugging, Git, and developer experience.
How to Install, Disable, Update, and Uninstall VS Code Extensions
Learn how to install, disable, update, and uninstall VS Code extensions from the Marketplace and the command line. Step-by-step instructions for every action.