Tracking Changes with Git (The Git Workflow)
Git maintains a comprehensive ledger of every change in your project—files added, deleted, or modified. Understanding how to tell Git which changes to record is fundamental to effective version control. Each recorded change is called a commit, and mastering this process is essential for professional development workflows.
Here's an illustration of the Git workflow:

Before creating a commit, you must explicitly tell Git which files to include—whether they're new untracked files, modified existing files, or deleted files. This deliberate selection process is called staging, and it's one of Git's most powerful features. The staging area acts as a buffer between your working directory and your commit history, giving you precise control over what gets recorded. Consider a common scenario: you're simultaneously fixing a critical bug and experimenting with a new feature across multiple files. The staging area allows you to commit only the bug fix immediately while keeping your experimental changes separate for later review. This granular control prevents incomplete or experimental code from polluting your project's history. Even file deletions must be explicitly staged and committed, ensuring that every change—addition, modification, or removal—is intentionally tracked in your project's timeline.
Check the Status of Your Files
Before making any commits, you need visibility into your repository's current state. Visual Studio Code's integrated Git tools provide an intuitive interface for monitoring file changes and managing your workflow.
Open a project folder in Visual Studio Code.
You can do this by going to File > Open (Mac) or File > Open Folder (Windows), navigate to your folder, select it, and hit Open (Mac) or Select Folder (Windows).
- Open the Source Control panel
on the left of the window. In the Source Control panel
, any modified work will appear under Changes with clear status indicators:M = modified U = untracked D = deleted
Pro tip: Within individual files, colored bars appear in the gutter (next to line numbers) to highlight exactly which lines have changed, making code reviews and debugging significantly more efficient.
Opening Your Project in VS Code
Access File Menu
Navigate to File > Open (Mac) or File > Open Folder (Windows) from the top menu bar
Select Project Directory
Browse to your Git repository folder and select it from the file system dialog
Open Source Control
Click the Source Control panel icon on the left sidebar to view your Git status
Git File Status Indicators
M - Modified
Files that have been changed since the last commit. These files exist in Git's history but contain new modifications.
U - Untracked
New files that Git has never seen before. These files need to be added to Git's tracking system.
D - Deleted
Files that have been removed from your working directory. Git needs to record these deletions in its history.
Stage Files to Prepare for Commit
The staging process is where you curate exactly what changes will be included in your next commit. This selective approach is what separates Git from simpler version control systems and enables sophisticated development workflows used by teams at major tech companies.
In the Source Control panel
:
To stage all files, hover over Changes and click the plus (+) that appears to its right.
To stage individual files, hover over the file name and click the plus (+) that appears to its right.
To unstage a file (if you accidentally staged it), hover over it and click the minus (–) that appears to its right.
Staging allows you to commit only the files that are ready, even when you're working on multiple files simultaneously. This granular control helps create clean, focused commits.
Staging Operations in VS Code
Stage All Changes
Hover over 'Changes' section and click the plus (+) button to stage all modified files at once
Stage Individual Files
Hover over specific file names and click their individual plus (+) buttons for selective staging
Unstage Files
Use the minus (-) button next to staged files to remove them from the staging area if needed
Commit Files
Creating meaningful commits is an art form that distinguishes professional developers. Your commit history tells the story of your project's evolution and serves as documentation for future maintainers—including your future self.
At the top of the Source Control panel
type in a commit message.Professional commit messages follow the imperative mood convention—write as if you're giving instructions to the codebase. Use "Add user authentication" rather than "Added user authentication" or "I added user authentication." This approach aligns with Git's own internal messaging system and creates consistency when working with teams. In collaborative environments, particularly when using pull requests or code reviews, these imperative messages clearly communicate what each change will accomplish when merged. Your colleagues will immediately understand that your commit will "Fix responsive layout bug" or "Update API endpoint configuration."
Execute the commit using one of these methods:
- Click the Commit button
at the top of the Source Control panel
. - Use the keyboard shortcut: Cmd+Return (Mac) or Ctrl+Enter (Windows) for faster workflow execution.
- Click the Commit button
Write commit messages in imperative mood like 'Make headings blue' rather than past tense like 'Made headings blue'. This communicates what your code will do when applied.
Commit Message Style Guide
| Feature | Poor Examples | Good Examples |
|---|---|---|
| Tense Usage | I made headings blue | Make headings blue |
| Specificity | Fixed stuff | Fix navigation menu overflow |
| Length | Updated the entire user interface styling and layout across multiple components | Update user interface styling |
Pre-Commit Checklist
Ensure only intended files are included in the commit
Describe what the commit will do, not what you did
Check the colored bars next to line numbers for modified lines
Complete the commit process to record changes permanently