Staging & Snapshotting in Git: Essential Commands
Understanding staging and snapshotting in Git helps you manage your code efficiently. Here are the key commands:
🔹 Staging Changes
- Check modified and staged files:
git status |
- Add a file to the staging area:
git add [file name] |
- Add all modified files:
git add . |
- Remove a file from staging without deleting changes:
git reset [file name] |
🔹 Viewing Differences
- Show changes before staging:
git diff |
- Show staged changes before committing:
git diff --staged |
🔹 Committing Changes
- Create a snapshot with a message:
git commit -m "[Your message]" |
Mastering these commands ensures smoother version control with Git!