Git workflow

Staging Area
- An intermediate area between working directory and commit
- Holds changes that are ready to be committed
- Files enter the staging area using
git add
Commit
After staging, files are ready to be committed.
- A commit is a snapshot of the repository at a specific time
- It saves the current state of the project
- Each commit includes a message describing the changes
Before making your first commit, configure Git with name and email.
# locally : only for the current repo
git config user.name "Your Name"
git config user.email "you@example.com"
# globally : applies to all repositories on system
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Common options:
git commit # opens editor to write message
git commit -m "message" # commit with a message
git commit -a -m "message" # stage & commit tracked files
git commit --amend # edit last commit
Git Commit Dependency
- In Git, every commit depends on the previous commit
- The first commit has no parent
- Each commit forms a linked history, allowing Git to track changes over time
Commit Message Reminder
- Keep each commit focused on one change (feature, component, or fix)
- Use present tense and imperative mood
- Think of the message as a command to the codebase
Example:
- ✅
Add user login validation - ❌
Added user login validation
Git is made up of objects that are stored in the .git/objects directory. A commit is just a type of object.