"jjj"
Git Commit
What is a Commit?
A commit in Git is like a save point. It records changes in your project, making it easy to track progress or revert if needed.
How to Commit?
Before committing, changes must be staged. Use: bash Copy Edit
Example:
git add . Git commit -m "Initial commit with project setup"
Example OutPut:
[main (root-commit) abc1234] Initial commit with project setup 2 files changed, 15 insertions(+) create mode 100644 index.html Create mode 100644 style.css
Here are some unique commit message lines that clearly describe changes:
Commit Without Staging
To commit modified files directly, use:
Example:
git commit -a -m "Updated homepage content"
Note: This skips the staging step and includes all modified tracked files. Be cautious!
View Commit History
To check commit history:
Example:
git log
Example OutPut:
commit d4e5678 (HEAD -> main)
Author: username
Date: Sat Mar 30 10:00:00 2025 +0000
Updated homepage content
commit abc1234
Author: username
Date: Sat Mar 30 09:30:00 2025 +0000
Initial commit with project setup
This helps in tracking past changes efficiently.
Now you're ready to commit confidently in Git!
Prefer Learning by Watching?
Watch these YouTube tutorials to understand GIT Tutorial visually:
What You'll Learn:
- 📌 Git Crash Course #7 - Viewing the Project History 🚀
- 📌 Git Basics: Git Commit Best Practices