rit log
Display commit history by traversing the parent chain.
Synopsis
rit log [--oneline] [--graph]
Description
This command displays the commit history starting from HEAD, traversing backwards through parent commits. It's similar to Git's log command.
Options
| Option | Description |
|---|---|
--oneline | Show one commit per line (short hash + message) |
--graph | Draw ASCII graph of commit history |
Examples
Basic Log
# Show full commit log
$ rit log
commit abc123def456...
Author: John Doe <john@example.com>
Date: 1234567890
Initial commit
commit def456ghi789...
Author: John Doe <john@example.com>
Date: 1234567891
Second commit
One-Line Format
$ rit log --oneline
abc123 Initial commit
def456 Second commit
ghi789 Third commit
With Graph
$ rit log --graph
* abc123 Initial commit
|
* def456 Second commit
|
* ghi789 Third commit
How It Works
- Reads HEAD to find the current commit
- If HEAD points to a branch ref, reads that ref file
- Traverses backwards through parent commits
- Formats and displays each commit
HEAD Resolution
The command resolves HEAD in this order:
- Branch Reference: If HEAD contains
ref: refs/heads/main, reads.rit/refs/heads/main - Detached HEAD: If HEAD contains a direct commit hash, uses that
- No Commits: If no commits exist, shows an error message
Use Cases
View Recent Commits
# See what you've committed
$ rit log --oneline
Check Commit History
# Full details of all commits
$ rit log
Visualize Branch Structure
# See commit graph (useful for branches)
$ rit log --graph
Implementation Details
Commit Traversal
The command follows the first parent of each commit, creating a linear history. For merge commits, it currently only follows the first parent.
Format
- Full format: Shows commit hash, author, date, and full message
- Oneline format: Shows short hash (7 chars) and first line of message
- Graph format: Adds ASCII visualization with
*and|characters
See Also
- commit-tree - Create commits
- cat-file - Read commit objects directly
- Architecture - Commit object format