Initializing a Repository and Inspecting File States
To track a project with Git, you must initialize a local repository.
1. Initializing a Repository
Open your terminal, navigate to your project directory, and initialize Git:
# Initialize local git repository
git initThis command creates a hidden .git directory in your root folder. This folder contains all version tracking data and history logs; deleting it removes all tracking history.
2. Inspecting the Workspace Status
Use git status to see which files are currently tracked, untracked, modified, or staged:
git statusThe output highlights file states in different colors:
- Untracked files (Red): New files created in your working directory that Git has not started tracking yet.
- Changes not staged for commit (Red): Modified versions of existing, tracked files.
- Changes to be committed (Green): Files added to the Staging Area, ready to be committed.
Published on Last updated: