How do you view commit history in Git?
You can view the commit history by using the command:
git log
This shows a list of commits, with each commit’s hash, author, date, and message.
Real-World Example:
Imagine you're trying to figure out when a bug was introduced to your code. By running git
log, you can see all previous commits, helping you pinpoint the changes that might have
caused the issue.
Branching & Merging