1. Modifying Files in the Working Area
Your working area (or working directory) is the local project directory on your computer. Every modification—whether it’s updating existing files or creating new ones—takes place here. For example, if you add a new file or change content within an existing file, you are modifying the working area.2. Staging Changes
The staging area gives you the flexibility to select which changes you want to include in your next commit. Instead of automatically tracking every change, Git allows you to only add the modifications relevant to a specific feature or bug fix. This selective process is useful when a file is still in progress or when grouping logically related changes together. For instance, if you add 50 lines of code today and plan to add another 50 lines tomorrow, you might not want to commit the half-finished feature immediately. Similarly, if you alter 10 different files to introduce a new feature, you can combine these into a single, cohesive commit.

Demo Scenario
Consider a project with two files. Start by creating these files with the following commands:git status command. This command displays untracked files and changes in your working directory:
git status again to confirm that the files are ready for commit:
Staging Multiple Files with Shortcuts
In larger projects, staging or unstaging multiple files can be streamlined with patterns:-
Add HTML Files from the Current Directory
Remember to enclose the pattern in quotes to prevent shell expansion of the asterisk.
-
Stage an Entire Subdirectory
-
Stage Only HTML Files from a Subdirectory
-
Unstage Multiple Files with a Pattern
Staging with patterns can save time and ensure that only specific files are included in your commit. Always verify your changes using
git status before committing.3. Committing Changes
Committing creates a snapshot of your project based on the files in the staging area. It’s best practice to include a concise commit message describing why the changes were made. For example, to commit the two files with a message, run:git diff to compare snapshots. The diff output highlights removed lines in red and added lines in green. Consider the following excerpt from a diff (from the Linux kernel repository):
Clear commit messages and detailed diffs are invaluable for collaborative environments where tracking changes is critical.
Reviewing Project History
Each commit in Git forms part of your project’s history, allowing you to track all changes over time. A well-written commit message helps team members understand the purpose behind each update. Git not only detects additions but also modifications and deletions.Example: Removing a File
Suppose you added a feature via a new file (file3) but later discovered a bug. First, create and commit the file:Recap
To summarize, Git change tracking consists of three main steps:- Modify your working area (project directory).
- Stage the changes you want to capture.
- Commit these changes to save a snapshot of your project’s state.