By completing this lab, you will:
- Create a Git repository
- Track files properly
- Use staging area correctly
- Make clean commits
- Understand history
mkdir git-basics-lab
cd git-basics-lab
git initecho "Hello Git" > app.txt
git status👉 Observe: file is untracked
git add app.txt
git status👉 Observe: file is staged
git commit -m "Initial commit"echo "New line added" >> app.txt
git status👉 Observe: file is modified
git diff👉 Understand what changed
git add app.txt
git commit -m "Update app.txt with new line"git log --onelineAfter commits:
.git/objects/contains blobs & commits.git/indextracks staged files.git/HEADpoints to current branch
- 2 commits created
- file tracked
- history visible
Try:
echo "Another file" > notes.txt
git add notes.txt
git commit -m "Add notes file"- skipping
git status - using
git add .blindly - bad commit messages
- full Git workflow
- staging vs commit
- tracking changes
- reading history
👉 Move to: 02-Branching/README.md