Skip to content

Latest commit

 

History

History
160 lines (100 loc) · 3.23 KB

File metadata and controls

160 lines (100 loc) · 3.23 KB

🧪 Practice Lab — Basics Mastery


🎯 Objective

By completing this lab, you will:

  • Create a Git repository
  • Track files properly
  • Use staging area correctly
  • Make clean commits
  • Understand history

📸 Visual (Workflow You’ll Practice)

Image

Image

Image

Image

Image

Image


🛠 Setup

mkdir git-basics-lab
cd git-basics-lab
git init

🧩 Task 1 — Create First File

echo "Hello Git" > app.txt
git status

👉 Observe: file is untracked


🧩 Task 2 — Stage File

git add app.txt
git status

👉 Observe: file is staged


🧩 Task 3 — First Commit

git commit -m "Initial commit"

🧩 Task 4 — Modify File

echo "New line added" >> app.txt
git status

👉 Observe: file is modified


🧩 Task 5 — Check Differences

git diff

👉 Understand what changed


🧩 Task 6 — Commit Changes

git add app.txt
git commit -m "Update app.txt with new line"

🧩 Task 7 — View History

git log --oneline

🧠 Internal Observation

After commits:

  • .git/objects/ contains blobs & commits
  • .git/index tracks staged files
  • .git/HEAD points to current branch

🎯 Expected Outcome

  • 2 commits created
  • file tracked
  • history visible

🔥 Bonus Challenge

Try:

echo "Another file" > notes.txt
git add notes.txt
git commit -m "Add notes file"

⚠️ Common Mistakes

  • skipping git status
  • using git add . blindly
  • bad commit messages

🧠 What You Learned

  • full Git workflow
  • staging vs commit
  • tracking changes
  • reading history

🚀 Next Step

👉 Move to: 02-Branching/README.md