Git & GitHub
/Intermediate
Repository History
Definition
The chronological log of all commits made in a repository, representing the entire timeline of changes from the project's inception.
Explain Like I'm New
The ledger. Every time someone makes a 'save' (commit), Git writes down Who did it, When they did it, What message they wrote, and a massive string of random letters and numbers (a Hash) that uniquely identifies that exact moment in time.
Real World Example
Looking through the history of Wikipedia edits to see who added a specific paragraph to an article, and when.
Common Use Cases
- •Auditing changes
- •Finding when a bug was introduced
- •Restoring lost code
Terminal Output
bash / terminal
# View the full history
$ git log
/* Output Example:
commit 8f9b2d3c4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b (HEAD -> main)
Author: John Doe <john@example.com>
Date: Tue Oct 10 14:32:11 2023 -0400
Fix the login button alignment
commit 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b
Author: Jane Smith <jane@example.com>
Date: Mon Oct 9 09:15:00 2023 -0400
Initial commit
*/
Interview Questions
basic
- What command lets you view the repository history?
intermediate
- What is a 'Commit Hash' (or SHA-1)?