Mastering Git Fundamentals: Git Init, Staging, and Commit

Here are the Git foundational concepts so far: => Git Initialization git init Initialize a new Git repository inside a project folder. => Git Remove (Untracking / Deleting Files) git rm filename Remove a file from both the working directory and Git tracking. Understanding the 3 Tiers (Stages) of Git — Beginner Learning While learning Git, one of the most important concepts I understood is the 3 stages (tiers) of Git. Git does not save changes automatically — we control what, when, and how code is saved. Here is a simple breakdown. 1. Working Directory (Working Tree) This is the project folder where we normally write code. -Create files -Modify files -Delete files Git notices changes but does not save them yet. Example: touch app.js Modify the file, then check status: git status Output shows: Untracked files Modified files -Changes exist only locally. 2. Staging Area (Index) The staging area is like a preparation zone. Here we tell Git: "These files should be included in the next commit." Add file to staging: git add app.js Add all files: git add . Check again: git status Now files appear as: -Changes to be committed 3. Local Repository This is Git’s permanent history storage. When we commit, Git saves a snapshot of the project. Save changes: git commit -m "Add app.js file" Now: -Version created -History stored -Changes safely recorded View commit history: git log 🔄 Complete Git Flow Working Directory ↓ git add Staging Area ↓ git commit Local Repository #Git #VersionControl #SoftwareEngineering #LearningJourney #DeveloperLife #DotNet #Angular #DevOpsJourney

To view or add a comment, sign in

Explore content categories