1. git log — Show Commit History
Shows all commits in the current branch.
git log
Output:
commit a1b2c3d4e5f6g7h8i9j0klmnopqrst
Author: Shanthakumar [email protected]
Date: Fri May 10 10:15:00 2025 +0530
Added login feature
________________________________________
2. git show commit-id — View Full Commit Details
Displays the commit message, author, date, and file changes.
git show a1b2c3d
Output:
commit a1b2c3d...
Author: Shanthakumar
Date: Fri May 10 10:15:00 2025 +0530
Added login feature
diff --git a/login.html b/login.html
new file mode 100644
form... /form
________________________________________
3. git diff — Compare Changes Between Versions
Compare Working Directory with Last Commit:
git diff
Compare Staged with Last Commit:
git diff --cached
Compare Two Commits:
git diff commit1 commit2
Output:
button Submit /button
button Login /button
________________________________________
4. git blame file — Show Who Made Each Line Change
Shows line-by-line author details in a file.
git blame login.html
Output:
a1b2c3d (Shanthakumar 2025-05-10) form
f6e5d4c (Kumar 2025-05-09) input type="text"
________________________________________
5. git reflog — View All Actions in Local History
Includes commits, resets, merges, rebase points—even unreachable commits.
git reflog
Output:
a1b2c3d HEAD@{0}: commit: Added login page
f6e5d4c HEAD@{1}: rebase -i (start)
9f8e7d6 HEAD@{2}: checkout: moving from master to dev