<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Git Editor - Comprehensive Technical Documentation</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
line-height: 1.6;
max-width: 1400px;
margin: 0 auto;
padding: 20px;
background: #f8f9fa;
color: #333;
}
.container {
background: white;
padding: 40px;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
position: relative;
}
h1 {
color: #2c3e50;
border-bottom: 3px solid #3498db;
padding-bottom: 10px;
margin-bottom: 30px;
font-size: 2.5em;
}
h2 {
color: #34495e;
margin-top: 50px;
margin-bottom: 25px;
border-left: 4px solid #3498db;
padding-left: 20px;
font-size: 1.8em;
}
h3 {
color: #2c3e50;
margin-top: 35px;
margin-bottom: 15px;
font-size: 1.4em;
}
h4 {
color: #34495e;
margin-top: 25px;
margin-bottom: 12px;
font-size: 1.2em;
}
.toc {
background: #ecf0f1;
padding: 25px;
border-radius: 8px;
margin-bottom: 40px;
border: 1px solid #bdc3c7;
}
.toc ul {
list-style-type: none;
padding-left: 0;
}
.toc li {
margin: 10px 0;
}
.toc a {
color: #2980b9;
text-decoration: none;
font-weight: 500;
transition: color 0.3s ease;
}
.toc a:hover {
color: #1f4e79;
text-decoration: underline;
}
code {
background: #f1f2f6;
padding: 3px 6px;
border-radius: 4px;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
color: #c7254e;
font-size: 0.9em;
}
.code-block {
position: relative;
margin: 25px 0;
}
pre {
background: #2c3e50;
color: #ecf0f1;
padding: 25px;
border-radius: 8px;
overflow-x: auto;
position: relative;
border: 1px solid #34495e;
}
pre code {
background: none;
color: inherit;
padding: 0;
font-size: 0.95em;
line-height: 1.5;
}
.copy-btn {
position: absolute;
top: 10px;
right: 10px;
background: #3498db;
color: white;
border: none;
padding: 6px 12px;
border-radius: 4px;
cursor: pointer;
font-size: 0.8em;
transition: all 0.3s ease;
opacity: 0.8;
}
.copy-btn:hover {
background: #2980b9;
opacity: 1;
}
.copy-btn:active {
transform: scale(0.95);
}
.copy-btn.copied {
background: #27ae60;
}
.example {
background: #e8f5e8;
border-left: 4px solid #27ae60;
padding: 20px;
margin: 25px 0;
border-radius: 0 8px 8px 0;
}
.warning {
background: #fef9e7;
border-left: 4px solid #f39c12;
padding: 20px;
margin: 25px 0;
border-radius: 0 8px 8px 0;
}
.danger {
background: #fdf2f2;
border-left: 4px solid #e74c3c;
padding: 20px;
margin: 25px 0;
border-radius: 0 8px 8px 0;
}
.info {
background: #e3f2fd;
border-left: 4px solid #2196f3;
padding: 20px;
margin: 25px 0;
border-radius: 0 8px 8px 0;
}
table {
width: 100%;
border-collapse: collapse;
margin: 25px 0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
th,
td {
border: 1px solid #ddd;
padding: 15px;
text-align: left;
}
th {
background-color: #34495e;
color: white;
font-weight: bold;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
.badge {
display: inline-block;
padding: 4px 10px;
border-radius: 12px;
font-size: 0.8em;
font-weight: bold;
margin: 2px;
}
.badge-primary {
background: #3498db;
color: white;
}
.badge-success {
background: #27ae60;
color: white;
}
.badge-warning {
background: #f39c12;
color: white;
}
.badge-danger {
background: #e74c3c;
color: white;
}
.badge-info {
background: #2196f3;
color: white;
}
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin: 30px 0;
}
.feature-card {
background: #f8f9fa;
padding: 20px;
border-radius: 8px;
border: 1px solid #e9ecef;
}
.syntax-highlight {
background: #2d3748;
color: #e2e8f0;
padding: 20px;
border-radius: 8px;
margin: 20px 0;
position: relative;
}
.command-section {
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 8px;
padding: 20px;
margin: 20px 0;
}
.flow-diagram {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
border-radius: 12px;
margin: 30px 0;
text-align: center;
}
.architecture-box {
background: #fff;
border: 2px solid #3498db;
border-radius: 8px;
padding: 15px;
margin: 10px;
text-align: center;
color: #2c3e50;
}
@media (max-width: 768px) {
.container {
padding: 20px;
}
h1 {
font-size: 2em;
}
.feature-grid {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="container">
<h1>🛠️ Git Editor - Complete Technical Documentation</h1>
<div class="toc">
<h3>📋 Table of Contents</h3>
<ul>
<li><a href="#overview">Overview & Architecture</a></li>
<li><a href="#installation">Installation & Setup</a></li>
<li><a href="#operation-modes">Operation Modes</a></li>
<li><a href="#command-reference">Complete Command Reference</a></li>
<li><a href="#technical-details">Technical Implementation</a></li>
<li><a href="#examples">Usage Examples & Workflows</a></li>
<li><a href="#advanced-features">Advanced Features</a></li>
<li><a href="#internals">Internal Architecture</a></li>
<li><a href="#development">Development Guide</a></li>
<li><a href="#troubleshooting">Troubleshooting & FAQ</a></li>
<li><a href="#api-reference">API Reference</a></li>
</ul>
</div>
<section id="overview">
<h2>🎯 Overview & Architecture</h2>
<p><strong>Git Editor</strong> is a sophisticated command-line tool written in Rust for comprehensive Git commit history manipulation. It provides surgical precision for rewriting timestamps, author information, and commit messages while maintaining repository integrity.</p>
<div class="info">
<strong>🔧 Core Capabilities:</strong>
<ul>
<li><strong>Timestamp Rewriting:</strong> Intelligent date distribution with realistic patterns</li>
<li><strong>Author Management:</strong> Bulk update of author name and email</li>
<li><strong>Interactive Selection:</strong> Pick specific commits or ranges</li>
<li><strong>Simulation Mode:</strong> Preview changes before applying</li>
<li><strong>Git URL Cloning:</strong> Direct operation on remote repositories</li>
</ul>
</div>
<div class="danger">
<strong>⚠️ Critical Warning:</strong> This tool permanently rewrites Git history. Always backup your repository before use. Force pushes will be required after history rewriting.
</div>
<div class="flow-diagram">
<h3>🔄 Git Editor Workflow</h3>
<div style="display: flex; justify-content: space-around; flex-wrap: wrap; margin-top: 20px;">
<div class="architecture-box">Input Validation</div>
<div class="architecture-box">Repository Analysis</div>
<div class="architecture-box">History Rewriting</div>
<div class="architecture-box">Verification</div>
</div>
</div>
</section>
<section id="installation">
<h2>💾 Installation & Setup</h2>
<h3>📥 From Release Binaries</h3>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Download the latest release for your platform
wget https://github.com/rohansen856/git-editor/releases/latest/download/git-editor-linux-x86_64.tar.gz
tar -xzf git-editor-linux-x86_64.tar.gz
sudo mv git-editor-linux-x86_64 /usr/local/bin/git-editor
# Verify installation
git-editor --help</code></pre>
</div>
<h3>🔨 From Source</h3>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Prerequisites: Rust 1.87+ and a C compiler (libgit2 is built from source)
rustup update stable
# Clone and build
git clone https://github.com/rohansen856/git-editor.git
cd git-editor
# Build release binary
cargo build --release
# Install globally
sudo cp target/release/git-editor /usr/local/bin/
# Or use cargo install
cargo install --path .</code></pre>
</div>
<h3>🐳 Docker Usage</h3>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Build Docker image
docker build -t git-editor .
# Run with repository mounted (-it is required: every prompt needs a TTY).
# The image runs as root; on Linux with rootful Docker, pass your uid so that
# libgit2's repository-ownership check passes and no root-owned files are written:
docker run -it --user "$(id -u):$(id -g)" -e HOME=/tmp \
-v /path/to/repo:/workspace git-editor --repo-path /workspace -s</code></pre>
</div>
<h3>📋 System Requirements</h3>
<div class="command-section">
<ul>
<li><strong>Operating System:</strong> Linux, macOS, Windows</li>
<li><strong>Memory:</strong> Minimum 100MB RAM</li>
<li><strong>Storage:</strong> 50MB for binary + temporary space for repository cloning</li>
<li><strong>Git:</strong> Not required at runtime: repositories, configuration and clones are handled by the bundled libgit2</li>
<li><strong>Network:</strong> Required only for Git URL cloning (docs are local HTML)</li>
</ul>
</div>
</section>
<section id="operation-modes">
<h2>🚀 Operation Modes</h2>
<p>Git Editor operates in distinct modes, each optimized for specific use cases:</p>
<table>
<thead>
<tr>
<th>Mode</th>
<th>Primary Flag</th>
<th>Description</th>
<th>Use Case</th>
<th>Required Args</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="badge badge-primary">Full Rewrite</span></td>
<td><em>Default</em></td>
<td>Complete repository history rewriting</td>
<td>Bulk timestamp and author updates</td>
<td>name, email, begin, end</td>
</tr>
<tr>
<td><span class="badge badge-success">Show History</span></td>
<td><code>-s, --show-history</code></td>
<td>Display commit history without modifications</td>
<td>Repository analysis and planning</td>
<td>repo-path only</td>
</tr>
<tr>
<td><span class="badge badge-warning">Pick Specific</span></td>
<td><code>-p, --pick-specific-commits</code></td>
<td>Interactive individual commit selection</td>
<td>Targeted commit modifications</td>
<td>repo-path only</td>
</tr>
<tr>
<td><span class="badge badge-warning">Range Edit</span></td>
<td><code>-x, --range</code></td>
<td>Select and edit commit ranges</td>
<td>Batch editing of consecutive commits</td>
<td>repo-path only</td>
</tr>
<tr>
<td><span class="badge badge-danger">Simulation</span></td>
<td><code>--simulate</code></td>
<td>Preview changes without applying</td>
<td>Safe testing and validation</td>
<td>Modifier for full rewrite, <code>-p</code> and <code>-x</code></td>
</tr>
<tr>
<td><span class="badge badge-info">Documentation</span></td>
<td><code>--docs</code></td>
<td>Open comprehensive documentation</td>
<td>Help and reference</td>
<td>None</td>
</tr>
</tbody>
</table>
<h3>🔄 Mode Priority System</h3>
<div class="info">
<p><strong>Precedence Order (highest to lowest):</strong></p>
<ol>
<li><code>--docs</code> - Always takes precedence</li>
<li><code>--simulate</code> - Dry-run preview (full rewrite path)</li>
<li><code>--range</code> (<code>-x</code>) - Range-based editing</li>
<li><code>--pick-specific-commits</code> (<code>-p</code>) - Interactive single-commit selection</li>
<li><code>--show-history</code> (<code>-s</code>) - Read-only history display</li>
<li>Full Rewrite - Default mode</li>
</ol>
</div>
</section>
<section id="command-reference">
<h2>📖 Complete Command Reference</h2>
<h3>🔧 Core Arguments</h3>
<table>
<thead>
<tr>
<th>Argument</th>
<th>Short</th>
<th>Type</th>
<th>Description</th>
<th>Example</th>
<th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--repo-path</code></td>
<td><code>-r</code></td>
<td>String</td>
<td>Local path or Git URL to repository</td>
<td><code>-r /path/to/repo</code><br><code>-r https://github.com/user/repo.git</code></td>
<td>❌ (defaults to ./)</td>
</tr>
<tr>
<td><code>--email</code></td>
<td>-</td>
<td>Email</td>
<td>New author email (full rewrite, <code>-p --commit</code>, <code>-x --select</code>)</td>
<td><code>--email user@example.com</code></td>
<td>Full rewrite (prompted if missing)</td>
</tr>
<tr>
<td><code>--name</code></td>
<td><code>-n</code></td>
<td>String</td>
<td>New author name</td>
<td><code>-n "John Doe"</code></td>
<td>Full rewrite (prompted if missing)</td>
</tr>
<tr>
<td><code>--begin</code></td>
<td><code>-b</code></td>
<td>DateTime</td>
<td>First new date: <code>YYYY-MM-DD HH:MM:SS</code> (UTC), optionally with an offset such as <code>+05:30</code>, or RFC 3339</td>
<td><code>-b "2023-01-01 09:00:00 +05:30"</code></td>
<td>Full rewrite unless <code>--keep-dates</code></td>
</tr>
<tr>
<td><code>--end</code></td>
<td><code>-e</code></td>
<td>DateTime</td>
<td>Last new date (same formats)</td>
<td><code>-e "2023-12-31 17:00:00"</code></td>
<td>Full rewrite unless <code>--keep-dates</code></td>
</tr>
<tr>
<td><code>--skip-range-check</code></td>
<td>-</td>
<td>Flag</td>
<td>Allow ranges shorter than 3h per commit: random gaps of at least 5 minutes, or even spacing when that does not fit (never duplicate seconds)</td>
<td><code>--skip-range-check</code></td>
<td>❌</td>
</tr>
<tr>
<td><code>--keep-dates</code></td>
<td>-</td>
<td>Flag</td>
<td>Full rewrite: keep every commit's original date and time zone</td>
<td><code>--keep-dates</code></td>
<td>❌</td>
</tr>
<tr>
<td><code>--committer</code></td>
<td>-</td>
<td>Enum</td>
<td><code>match-author</code> (default): committer follows the edited author fields; <code>keep</code>: committer unchanged</td>
<td><code>--committer keep</code></td>
<td>❌</td>
</tr>
<tr>
<td><code>--commit</code></td>
<td>-</td>
<td>String</td>
<td>With <code>-p</code>: commit number (1 = newest, as listed by <code>-s</code>) or hash prefix, no menu</td>
<td><code>-p --commit 3</code></td>
<td>❌</td>
</tr>
<tr>
<td><code>--set-date</code> / <code>--set-message</code></td>
<td>-</td>
<td>String</td>
<td>With <code>-p --commit</code>: new author date / new message</td>
<td><code>--set-message "Fix typo"</code></td>
<td>❌</td>
</tr>
<tr>
<td><code>--select</code></td>
<td>-</td>
<td>Range</td>
<td>With <code>-x</code>: <code>N-M</code>, <code>N</code> or <code>*</code>, no table; combine with <code>--name</code>, <code>--email</code>, <code>--begin</code>/<code>--end</code></td>
<td><code>-x --select 2-5</code></td>
<td>❌</td>
</tr>
<tr>
<td><code>--yes</code></td>
<td><code>-y</code></td>
<td>Flag</td>
<td>Confirm automatically (scripts and agents)</td>
<td><code>--yes</code></td>
<td>❌</td>
</tr>
<tr>
<td><code>--json</code></td>
<td>-</td>
<td>Flag</td>
<td>Print one JSON document on stdout (history, preview, result or error); progress goes to stderr</td>
<td><code>-s --json</code></td>
<td>❌</td>
</tr>
<tr>
<td><code>--clone-dir</code></td>
<td>-</td>
<td>Path</td>
<td>When <code>--repo-path</code> is a URL, keep the clone in this directory (required to rewrite a URL)</td>
<td><code>--clone-dir ./repo-copy</code></td>
<td>❌</td>
</tr>
<tr>
<td><code>--docs-out</code></td>
<td>-</td>
<td>Path</td>
<td>With <code>--docs</code>: write the HTML to this file</td>
<td><code>--docs --docs-out docs.html</code></td>
<td>❌</td>
</tr>
</tbody>
</table>
<h3>🎛️ Mode Flags</h3>
<table>
<thead>
<tr>
<th>Flag</th>
<th>Short</th>
<th>Description</th>
<th>Conflicts With</th>
<th>Additional Options</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--show-history</code></td>
<td><code>-s</code></td>
<td>Display repository commit history</td>
<td>Other mode flags (<code>-s</code>, <code>-p</code>, <code>-x</code>, <code>--docs</code>): rejected</td>
<td>None</td>
</tr>
<tr>
<td><code>--pick-specific-commits</code></td>
<td><code>-p</code></td>
<td>Interactive commit selection</td>
<td>Other mode flags (<code>-s</code>, <code>-p</code>, <code>-x</code>, <code>--docs</code>): rejected</td>
<td>None</td>
</tr>
<tr>
<td><code>--range</code></td>
<td><code>-x</code></td>
<td>Range-based commit editing</td>
<td>Other mode flags (<code>-s</code>, <code>-p</code>, <code>-x</code>, <code>--docs</code>): rejected</td>
<td><code>--message</code>, <code>--author</code>, <code>--time</code></td>
</tr>
<tr>
<td><code>--simulate</code></td>
<td>-</td>
<td>Dry-run mode (preview only)</td>
<td><code>-s</code>, <code>--docs</code></td>
<td><code>--show-diff</code></td>
</tr>
<tr>
<td><code>--docs</code></td>
<td>-</td>
<td>Open documentation in browser</td>
<td>Every other mode and <code>--simulate</code>: rejected</td>
<td>None</td>
</tr>
</tbody>
</table>
<h3>⚙️ Range Mode Modifiers</h3>
<div class="command-section">
<p>These flags work exclusively with <code>--range</code> mode:</p>
<table>
<thead>
<tr>
<th>Flag</th>
<th>Description</th>
<th>Effect</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--message</code></td>
<td>Edit only commit messages</td>
<td>Author name/email and timestamp fields are not editable; author, committer and dates stay untouched</td>
</tr>
<tr>
<td><code>--author</code></td>
<td>Edit only author information</td>
<td>Message and timestamp fields are not editable</td>
</tr>
<tr>
<td><code>--time</code></td>
<td>Edit only timestamps</td>
<td>Message and author fields are not editable</td>
</tr>
</tbody>
</table>
<div class="info">
<strong>Note:</strong> If no modifier flags are specified with <code>--range</code>, all fields (message, author, timestamp) will be editable.
</div>
</div>
<h3>🔍 Simulation Options</h3>
<table>
<thead>
<tr>
<th>Flag</th>
<th>Description</th>
<th>Output</th>
<th>Requires</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--show-diff</code></td>
<td>Show detailed change preview</td>
<td>Before/after comparison for each commit</td>
<td>Any preview (dry run or before confirming)</td>
</tr>
</tbody>
</table>
</section>
<section id="technical-details">
<h2>🔬 Technical Implementation</h2>
<h3>📊 Date Distribution Algorithm</h3>
<div class="info">
<p>Git Editor distributes timestamps with random weighted gaps while preserving commit order:</p>
<ul>
<li><strong>Chronological Preservation:</strong> the oldest commit gets <code>--begin</code>, the newest gets exactly <code>--end</code>, and dates strictly increase in between</li>
<li><strong>Minimum Gap:</strong> At least 3 hours between commits by default (validated against <code>--begin</code>/<code>--end</code>)</li>
<li><strong>Random Weights:</strong> Gaps are randomized across the available slack, in whole seconds</li>
<li><strong><code>--skip-range-check</code>:</strong> for ranges shorter than 3h × (commits − 1): gaps of at least 5 minutes, or even spacing (at least one second apart) if 5 minutes do not fit</li>
<li><strong>Time zone:</strong> dates without an offset are UTC; with an offset (e.g. <code>+05:30</code>) the generated dates are written in that zone</li>
<li><strong>Keep dates:</strong> <code>--keep-dates</code> (or pressing Enter on both prompted date defaults) keeps every commit's own date and offset and changes only the identity</li>
</ul>
</div>
<h3>🔐 Git Operations & Safety</h3>
<div class="command-section">
<h4>Repository Validation</h4>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Git Editor performs these validations:
1. The path exists and is (inside) a Git repository; bare repositories work
2. Email / name / dates are valid; names and emails may not contain < > or newlines
3. Date range large enough for commit count (unless --skip-range-check)
4. HEAD is a branch with commits (detached or unborn HEAD is refused)
5. The branch did not move since the preview (otherwise nothing is written)</code></pre>
</div>
<h4>History Rewriting Process</h4>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Internal rewriting workflow:
1. Build a plan: edits keyed by commit id (previews render the same plan)
2. Walk HEAD history oldest-first
3. Reuse every commit that has no edit and unchanged parents (same id, signature kept)
4. Rebuild the others from their raw object: new parents, edited author fields,
committer per --committer; encoding, mergetag, other headers, raw message
bytes and time-zone offsets are kept; signatures are dropped (they would not verify)
5. Rewrite matching Signed-off-by / Co-authored-by / Authored-by lines in the trailer block
6. Save the old tip as refs/git-editor/backup/<branch>
7. Move refs/heads/<branch> with a compare-and-swap; report other refs still on the old history
# Undo:
git reset --keep refs/git-editor/backup/<branch></code></pre>
</div>
</div>
<h3>🤖 Automation & Agents</h3>
<div class="info">
<ul>
<li><strong>Non-interactive:</strong> <code>-p --commit</code> and <code>-x --select</code> replace the menu and table; <code>--yes</code> confirms. Without a terminal, prompts read plain lines from stdin and fail (instead of hanging) when stdin is closed.</li>
<li><strong>JSON:</strong> <code>--json</code> prints one document on stdout: the history, the preview, the rewrite result (old/new ids, backup ref, stale refs) or the error.</li>
<li><strong>Workflow:</strong> <code>-s --json</code> → <code>--simulate --json</code> → <code>--yes --json</code>. See <code>AGENTS.md</code> in the repository.</li>
<li><strong>Colors</strong> are disabled automatically when output is not a terminal.</li>
</ul>
</div>
<h3>⌨️ Interactive Controls</h3>
<div class="command-section">
<ul>
<li><strong>Prompts:</strong> Esc or Ctrl+C cancels (exit code 130); confirmations accept <code>y</code> or <code>yes</code>.</li>
<li><strong>Range table:</strong> arrow keys or h/j/k/l to move, Enter to edit a cell, Esc to save & exit, <code>q</code> or Ctrl+C to cancel without saving. Long tables scroll; validation errors are shown below the table.</li>
<li><strong>Pick mode messages:</strong> finish a new message with a line containing only <code>.</code>; blank lines and indentation are kept.</li>
<li><strong>Dates in tables</strong> are shown in UTC; edits accept an offset such as <code>+05:30</code>.</li>
</ul>
</div>
<h3>🌐 Git URL Support</h3>
<div class="feature-grid">
<div class="feature-card">
<h4>📡 Supported Protocols</h4>
<ul>
<li>HTTPS: <code>https://github.com/user/repo.git</code></li>
<li>SSH: <code>git@github.com:user/repo.git</code> (via ssh-agent)</li>
<li>HTTP: <code>http://example.com/repo.git</code></li>
<li>git: <code>git://example.com/repo.git</code></li>
</ul>
</div>
<div class="feature-card">
<h4>🔄 Clone Behavior</h4>
<ul>
<li>Read-only modes (<code>-s</code>, <code>--simulate</code>) use a temporary clone removed on exit</li>
<li>Rewriting a URL requires <code>--clone-dir <DIR></code>; push from that directory afterwards</li>
<li>Authentication via ssh-agent and Git credential helpers</li>
<li>Credentials embedded in a URL are masked in all output</li>
</ul>
</div>
</div>
<h3>⚡ Performance Characteristics</h3>
<table>
<thead>
<tr>
<th>Repository Size</th>
<th>Commit Count</th>
<th>Processing Time</th>
<th>Memory Usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>Small (<10MB)</td>
<td><1,000</td>
<td><10 seconds</td>
<td><50MB</td>
</tr>
<tr>
<td>Medium (10-100MB)</td>
<td>1,000-10,000</td>
<td>10-60 seconds</td>
<td>50-200MB</td>
</tr>
<tr>
<td>Large (100MB-1GB)</td>
<td>10,000-100,000</td>
<td>1-10 minutes</td>
<td>200MB-1GB</td>
</tr>
<tr>
<td>Enterprise (>1GB)</td>
<td>>100,000</td>
<td>>10 minutes</td>
<td>>1GB</td>
</tr>
</tbody>
</table>
</section>
<section id="examples">
<h2>💡 Usage Examples & Workflows</h2>
<h3>🎯 Basic Operations</h3>
<h4>📚 Open Documentation</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>git-editor --docs</code></pre>
</div>
<p>Opens this comprehensive documentation in your default browser.</p>
</div>
<h4>📖 Repository Analysis</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Show history of current directory
git-editor -s
# Analyze specific repository
git-editor --repo-path /path/to/repo --show-history
# Analyze remote repository
git-editor -r https://github.com/user/repo.git -s</code></pre>
</div>
<p>Displays comprehensive commit history without making any changes.</p>
</div>
<h3>🔄 Complete History Rewriting</h3>
<h4>📝 Basic Full Rewrite</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>git-editor \
--name "John Doe" \
--email john@example.com \
--begin "2023-01-01 09:00:00" \
--end "2023-12-31 17:00:00"</code></pre>
</div>
<p>Rewrites all commits reachable from <code>HEAD</code> with new author info and timestamps distributed between the specified dates, then moves the current branch to the new tip.</p>
</div>
<h4>🌍 Remote Repository Rewrite</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Clone into a directory you keep, rewrite it, then push from it
git-editor \
--repo-path https://github.com/user/repo.git \
--clone-dir ./repo-rewritten \
--name "Corporate Identity" \
--email corporate@company.com \
--begin "2023-06-01 08:00:00" \
--end "2023-06-30 18:00:00"
git -C ./repo-rewritten push --force-with-lease</code></pre>
</div>
<p>Without <code>--clone-dir</code>, a URL is cloned into a temporary directory that is removed on exit; that is fine for <code>-s</code> and <code>--simulate</code>, and write modes refuse to run so a rewrite is never silently lost.</p>
</div>
<h3>🎯 Targeted Editing</h3>
<h4>🔍 Interactive Commit Selection</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Interactive commit picker
git-editor --pick-specific-commits
# With specific repository
git-editor -r /path/to/repo --pick-specific-commits</code></pre>
</div>
<p>Provides an interactive interface to select and edit individual commits.</p>
</div>
<h4>📊 Range-Based Editing</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Edit all fields in a range
git-editor --range
# Edit only commit messages
git-editor --range --message
# Edit only author information
git-editor --range --author
# Edit only timestamps
git-editor --range --time
# Multiple field editing
git-editor --range --message --author</code></pre>
</div>
<p>Select a range of commits (e.g., commits 5-11) and edit specific fields.</p>
</div>
<h3>🔍 Simulation & Preview</h3>
<h4>🧪 Dry-Run Testing</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Basic simulation
git-editor --simulate \
--name "Test User" \
--email test@example.com \
--begin "2023-01-01 09:00:00" \
--end "2023-01-31 17:00:00"
# Detailed diff preview
git-editor --simulate --show-diff \
--name "John Doe" \
--email john@example.com \
--begin "2023-06-01 08:00:00" \
--end "2023-06-30 18:00:00"</code></pre>
</div>
<p>Previews all changes with detailed diffs without applying them.</p>
</div>
<h4>🔄 Simulation with Other Modes</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Preview a pick-mode edit (menu or flags)
git-editor --simulate -p --commit 2 --set-message "Reworded"
# Preview a range edit made in the table, or from flags
git-editor --simulate --range --message
git-editor --simulate --show-diff -x --select 1-3 --name "Jane"</code></pre>
</div>
<p>With <code>-p</code> and <code>-x</code>, simulation runs the normal selection and editing, shows exactly what would be written, and stops before writing.</p>
</div>
<h3>🔧 Advanced Workflows</h3>
<h4>🎭 Privacy & Anonymization</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Anonymize commit history
git-editor \
--name "Anonymous Contributor" \
--email anonymous@privacy.local \
--begin "2023-01-01 00:00:00" \
--end "2023-12-31 23:59:59"
# Corporate identity standardization
git-editor \
--name "Development Team" \
--email dev-team@company.com \
--begin "2023-04-01 09:00:00" \
--end "2023-04-30 17:00:00"</code></pre>
</div>
<p>Standardize or anonymize commit authorship for privacy or corporate compliance.</p>
</div>
<h4>📅 Timeline Compression/Expansion</h4>
<div class="example">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Compress 6 months of work into 1 month
git-editor \
--name "Rapid Developer" \
--email rapid@dev.com \
--begin "2023-11-01 08:00:00" \
--end "2023-11-30 20:00:00"
# Expand 1 week into 3 months
git-editor \
--name "Consistent Contributor" \
--email consistent@dev.com \
--begin "2023-09-01 09:00:00" \
--end "2023-11-30 17:00:00"</code></pre>
</div>
<p>Adjust project timelines for demos, portfolio presentation, or analysis.</p>
</div>
</section>
<section id="advanced-features">
<h2>🔧 Advanced Features</h2>
<h3>🧠 Timestamp Distribution</h3>
<div class="info">
<p>Timestamps are generated with random weighted gaps inside <code>--begin</code>/<code>--end</code>, keeping commit order. Default rule: at least 3 hours between commits. Use <code>--skip-range-check</code> for tighter packing (5-minute minimum gap).</p>
</div>
<h3>🔄 Interactive Features</h3>
<h4>🎮 Pick Specific Commits Interface</h4>
<div class="command-section">
<p>The interactive commit picker provides:</p>
<ul>
<li><strong>Numbered Commit List:</strong> Index, short hash, date, author, message preview</li>
<li><strong>Single Selection:</strong> Enter a commit number to edit</li>
<li><strong>Field Prompts:</strong> Edit name, email, timestamp, and/or message for that commit</li>
<li><strong>Confirmation:</strong> Review changes before rewriting descendants as needed</li>
</ul>
</div>
<h4>📊 Range Selection Interface</h4>
<div class="command-section">
<p>Range editing supports:</p>
<ul>
<li><strong>Commit Numbering:</strong> Display commits with sequential numbers</li>
<li><strong>Range Syntax:</strong> <code>start-end</code> (e.g. <code>5-11</code>) or <code>*</code> for all commits</li>
<li><strong>Field Selection:</strong> Limit columns with <code>--message</code>, <code>--author</code>, and/or <code>--time</code></li>
<li><strong>Crossterm TUI:</strong> Spreadsheet-style editor (arrow keys, edit cells, confirm to apply)</li>
</ul>
</div>
<h3>🔍 Simulation & Analysis</h3>
<div class="info">
<p><strong>Simulation Mode provides:</strong></p>
<ul>
<li><strong>Change Summary:</strong> Shows how many commits would be affected</li>
<li><strong>Validation:</strong> Same email, name and date checks as a real rewrite</li>
<li><strong>Author Preview:</strong> Planned author/email updates</li>
<li><strong>Detailed Diff:</strong> Per-commit before/after with <code>--show-diff</code></li>
<li><strong>No Mutation:</strong> Repository is left unchanged</li>
</ul>
</div>
<h3>🌐 Git URL Processing</h3>
<div class="command-section">
<h4>Automatic Repository Detection</h4>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Supported URL formats:
https://github.com/user/repo.git
https://github.com/user/repo
git@github.com:user/repo.git
https://gitlab.com/user/repo.git
https://bitbucket.org/user/repo.git
# URL normalization and validation
# Automatic .git suffix handling
# Repository name extraction for display (the temporary directory itself has a random name)</code></pre>
</div>
</div>
</section>
<section id="internals">
<h2>🏗️ Internal Architecture</h2>
<h3>📁 Project Structure</h3>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>git-editor/
├── src/
│ ├── main.rs # Entry point and mode dispatch
│ ├── lib.rs # Library re-exports (args, rewrite, utils)
│ ├── args.rs # CLI argument parsing (clap)
│ ├── docs.rs # Documentation generation
│ ├── rewrite/
│ │ ├── mod.rs # Rewrite module exports
│ │ ├── rewrite_all.rs # Full history rewriting
│ │ ├── rewrite_specific.rs # Interactive commit selection
│ │ └── rewrite_range.rs # Range-based editing (crossterm TUI)
│ └── utils/
│ ├── mod.rs # Utility module exports
│ ├── types.rs # Common types and aliases
│ ├── validator.rs # Input validation
│ ├── datetime.rs # Timestamp generation
│ ├── commit_history.rs# Git operations
│ ├── prompt.rs # User interaction
│ ├── git_clone.rs # Repository cloning
│ ├── git_config.rs # Git configuration
│ ├── message_trailers.rs # Signed-off-by / Co-authored-by rewrites
│ ├── simulation.rs # Dry-run functionality
│ └── help.rs # Custom help text (unused; clap --help is primary)
├── docs/
│ └── template.html # Documentation template
├── tests/
│ └── integration_tests.rs # Integration test suite
├── Cargo.toml # Dependencies and metadata
├── Dockerfile # Container configuration
└── Makefile # Build automation</code></pre>
</div>
<h3>🔗 Key Dependencies</h3>
<table>
<thead>
<tr>
<th>Crate</th>
<th>Version</th>
<th>Purpose</th>
<th>Features Used</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>git2</code></td>
<td>0.20+</td>
<td>Git repository operations</td>
<td>Repository access, commit manipulation</td>
</tr>
<tr>
<td><code>clap</code></td>
<td>4.5+</td>
<td>Command-line argument parsing</td>
<td>Derive API, help generation</td>
</tr>
<tr>
<td><code>chrono</code></td>
<td>0.4+</td>
<td>Date/time handling</td>
<td>DateTime parsing (naive UTC; no time-zone handling)</td>
</tr>
<tr>
<td><code>colored</code></td>
<td>3.0+</td>
<td>Terminal output coloring</td>
<td>ANSI color codes, cross-platform</td>
</tr>
<tr>
<td><code>tempfile</code></td>
<td>3.20+</td>
<td>Temporary directory management</td>
<td>Auto-cleanup, secure temp files</td>
</tr>
<tr>
<td><code>open</code></td>
<td>5.0+</td>
<td>Browser launching</td>
<td>Cross-platform file opening</td>
</tr>
<tr>
<td><code>url</code></td>
<td>2.5+</td>
<td>URL parsing and validation</td>
<td>Git URL parsing</td>
</tr>
<tr>
<td><code>regex</code></td>
<td>1.11+</td>
<td>Pattern matching</td>
<td>Email validation, date parsing</td>
</tr>
</tbody>
</table>
<h3>🏛️ Architecture Patterns</h3>
<div class="feature-grid">
<div class="feature-card">
<h4>🎯 Error Handling</h4>
<ul>
<li>Custom Result type alias</li>
<li>Comprehensive error propagation</li>
<li>User-friendly error messages</li>
<li>Graceful degradation</li>
</ul>
</div>
<div class="feature-card">
<h4>🔧 Modularity</h4>
<ul>
<li>Separate modules by responsibility</li>
<li>Clear interface boundaries</li>
<li>Reusable utility functions</li>
<li>Testable components</li>
</ul>
</div>
</div>
<h3>🧪 Testing Strategy</h3>
<div class="command-section">
<table>
<thead>
<tr>
<th>Test Type</th>
<th>Count</th>
<th>Coverage</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Unit Tests</strong></td>
<td>100</td>
<td>Core logic</td>
<td>Parsing, validation, dates, trailers, table editor, JSON</td>
</tr>
<tr>
<td><strong>Engine Tests</strong></td>
<td>12</td>
<td>Rewrite engine</td>
<td>Commit reuse, preserved headers/offsets, committer modes, merges, backup refs, git fsck</td>
</tr>
<tr>
<td><strong>End-to-End Tests</strong></td>
<td>11</td>
<td>CLI binary</td>
<td>Non-interactive runs with --yes/--json against throwaway repositories</td>
</tr>
<tr>
<td><strong>Integration Tests</strong></td>
<td>21</td>
<td>Library flows</td>
<td>History, timestamps, validation, docs, argument parsing</td>
</tr>
<tr>
<td><strong>Doc Tests</strong></td>
<td>0</td>
<td>Documentation</td>
<td>Code example validation</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="development">
<h2>🛠️ Development Guide</h2>
<h3>🚀 Build Commands</h3>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Development build (fast compilation)
cargo build
# Release build (optimized)
cargo build --release
# Run with arguments
cargo run -- --help
cargo run -- --repo-path . -s
# Watch mode for development
cargo watch -x "run -- --docs"</code></pre>
</div>
<h3>🧪 Testing</h3>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Run all tests (unit, engine, end-to-end, integration)
cargo test
# Run unit tests only
cargo test --lib
# Run the rewrite engine and end-to-end suites
cargo test --test engine
cargo test --test e2e
# Run integration tests only
cargo test --test integration_tests
# Run specific test with output
cargo test --test integration_tests test_show_history_mode_integration -- --nocapture
# Run tests without browser opening (for development)
GIT_EDITOR_NO_BROWSER=1 cargo test --all</code></pre>
</div>
<h3>✨ Code Quality</h3>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Format code
cargo fmt
# Check formatting without changes
cargo fmt --check
# Run linter
cargo clippy
# Run linter with strict warnings (CI requirement)
cargo clippy --all-targets --all-features -- -D warnings
# Security audit
cargo audit
# Check for outdated dependencies
cargo outdated</code></pre>
</div>
<h3>📦 Makefile Commands</h3>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># Build release binary
make build
# Run all tests
make test
# Check code formatting
make fmt
# Run clippy linter
make lint
# Run with default parameters
make run
# Run with custom environment variables
make run-custom
# Clean build artifacts
make clean
# Build Docker image
make docker-build
# Run in Docker container
make docker-run
# Install binary to /usr/local/bin
make install
# Show all available commands
make help</code></pre>
</div>
<h3>🔄 Development Workflow</h3>
<div class="command-section">
<ol>
<li><strong>Setup:</strong> Clone repository and run <code>cargo build</code></li>
<li><strong>Development:</strong> Make changes and test with <code>cargo run</code></li>
<li><strong>Testing:</strong> Run <code>cargo test</code> to ensure no regressions</li>
<li><strong>Quality:</strong> Check with <code>cargo fmt</code> and <code>cargo clippy</code></li>
<li><strong>Integration:</strong> Test end-to-end with <code>make test</code></li>
<li><strong>Documentation:</strong> Update docs and test with <code>--docs</code></li>
</ol>
</div>
<h3>🎯 Contribution Guidelines</h3>
<div class="info">
<ul>
<li><strong>Code Style:</strong> Follow Rust standard formatting (rustfmt)</li>
<li><strong>Testing:</strong> Add tests for all new functionality</li>
<li><strong>Documentation:</strong> Update inline docs and this template</li>
<li><strong>Error Handling:</strong> Use the custom Result type consistently</li>
<li><strong>Performance:</strong> Consider memory usage for large repositories</li>
</ul>
</div>
</section>
<section id="troubleshooting">
<h2>🔧 Troubleshooting & FAQ</h2>
<h3>❗ Common Issues</h3>
<h4>🔍 Repository Not Found</h4>
<div class="danger">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>Error: Invalid repository path or URL: /invalid/path
Error: Repository path does not contain a valid Git repository: /path</code></pre>
</div>
<p><strong>Solutions:</strong></p>
<ul>
<li>Verify the repository path exists: <code>ls -la /path/to/repo</code></li>
<li>Ensure .git directory is present: <code>ls -la /path/to/repo/.git</code></li>
<li>Check permissions: <code>ls -ld /path/to/repo</code></li>
<li>For Git URLs, verify network connectivity and authentication</li>
</ul>
</div>
<h4>🗓️ Invalid Date Format</h4>
<div class="danger">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>Error: Invalid start date format (expected YYYY-MM-DD HH:MM:SS): 2023-1-1</code></pre>
</div>
<p><strong>Solutions:</strong></p>
<ul>
<li>Use exact format: <code>YYYY-MM-DD HH:MM:SS</code></li>
<li>Zero-pad single digits: <code>2023-01-01 09:00:00</code></li>
<li>Use 24-hour time format</li>
<li>Ensure end date is after start date</li>
</ul>
</div>
<h4>📧 Email Validation Errors</h4>
<div class="danger">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>Error: Invalid email format: user@domain</code></pre>
</div>
<p><strong>Solutions:</strong></p>
<ul>
<li>Include top-level domain: <code>user@domain.com</code></li>
<li>The validator is a simple pattern (<code>letters, digits, . _ % + -</code> before <code>@</code>, a domain with a dot), not full RFC 5322</li>
<li>Quoted local parts and spaces are not accepted</li>
</ul>
</div>
<h4>🌐 Git URL Authentication</h4>
<div class="warning">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>Error: Failed to clone repository '<url>': authentication failed: no usable credentials from ssh-agent or git credential helpers</code></pre>
</div>
<p><strong>Solutions:</strong></p>
<ul>
<li>SSH URLs: make sure your key is loaded (<code>ssh-add -l</code>)</li>
<li>HTTPS URLs: configure a credential helper (<code>git config --global credential.helper ...</code>)</li>
<li>Test with <code>git clone</code> first; credentials embedded in URLs are masked in output</li>
</ul>
</div>
<h3>🔧 Performance Issues</h3>
<h4>⚡ Large Repository Optimization</h4>
<div class="command-section">
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code># For large repositories, consider:
# 1. Use simulation mode first
git-editor --simulate --show-diff [other-args]
# 2. Process in smaller ranges
git-editor --range --message # Edit specific fields only
# 3. Monitor system resources
htop # Watch memory and CPU usage
# 4. Ensure sufficient disk space
df -h # Check available space</code></pre>
</div>
</div>
<h4>💾 Memory Management</h4>
<div class="info">
<p><strong>Memory optimization tips:</strong></p>
<ul>
<li>Close other applications before processing large repos</li>
<li>Use range mode for selective editing instead of full rewrite</li>
<li>Consider splitting very large repositories</li>
<li>Monitor swap usage during processing</li>
</ul>
</div>
<h3>❓ Frequently Asked Questions</h3>
<div class="command-section">
<h4>🔄 Can I undo changes after rewriting history?</h4>
<p><strong>Answer:</strong> History rewriting is permanent. However, you can:</p>
<ul>
<li>Every rewrite saves the old tip: <code>git reset --keep refs/git-editor/backup/<branch></code></li>
<li>Use Git reflog to find previous HEAD positions</li>
<li>Restore from backups if available</li>
<li>Use simulation mode to preview changes first</li>
</ul>
</div>
<div class="command-section">
<h4>🌍 Does this work with remote repositories?</h4>
<p><strong>Answer:</strong> Yes, Git Editor can clone and process remote repositories:</p>
<ul>
<li>Supports HTTPS, SSH, HTTP and git:// URLs</li>
<li>Authenticates with ssh-agent and Git credential helpers</li>
<li>Read-only modes use a temporary clone; rewrites need <code>--clone-dir</code></li>
<li>Push the rewritten clone yourself with <code>git push --force-with-lease</code></li>
</ul>
</div>
<div class="command-section">
<h4>🏢 Is this safe for production repositories?</h4>
<p><strong>Answer:</strong> Use with extreme caution:</p>
<ul>
<li>Always test on a backup first</li>
<li>Use simulation mode for validation</li>
<li>Coordinate with team members before rewriting shared history</li>
<li>Consider impact on CI/CD pipelines and deployment history</li>
</ul>
</div>
<h3>🆘 Getting Help</h3>
<div class="command-section">
<p>If you encounter issues:</p>
<ul>
<li>📖 Check this documentation first: <code>git-editor --docs</code></li>
<li>🐛 Search existing issues: <a href="https://github.com/rohansen856/git-editor/issues">GitHub Issues</a></li>
<li>📚 Review the project README: <a href="https://github.com/rohansen856/git-editor">Project Repository</a></li>
<li>🆕 Create a new issue with:
<ul>
<li>Exact command that failed</li>
<li>Complete error message</li>
<li>Operating system and Git version</li>
<li>Repository size and commit count (approximate)</li>
</ul>
</li>
</ul>
</div>
</section>
<section id="api-reference">
<h2>📚 API Reference</h2>
<h3>🔧 Core Library Surface</h3>
<h4>📊 History</h4>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>// Walk HEAD and optionally print history
pub fn get_commit_history(args: &Args, print: bool) -> Result<Vec<CommitInfo>></code></pre>
</div>
<h4>⏰ Timestamp Generation</h4>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>// Generate random-gap timestamps for full rewrite (mutates args if cloning)
pub fn generate_timestamps(args: &mut Args) -> Result<Vec<NaiveDateTime>></code></pre>
</div>
<h4>🔄 History Rewriting</h4>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>// Full repository history rewrite (timestamps from generate_timestamps)
pub fn rewrite_all_commits(args: &Args, timestamps: Vec<NaiveDateTime>) -> Result<()>
// Interactive single-commit selection and editing
pub fn rewrite_specific_commits(args: &Args) -> Result<()>
// Range-based commit editing (crossterm TUI)
pub fn rewrite_range_commits(args: &Args) -> Result<()></code></pre>
</div>
<h3>📈 Data Structures</h3>
<h4>💾 CommitInfo</h4>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>pub struct CommitInfo {
pub oid: git2::Oid, // Full commit object id
pub short_hash: String, // Abbreviated hash
pub timestamp: NaiveDateTime, // Commit timestamp
pub author_name: String, // Author display name
pub author_email: String, // Author email address
pub message: String, // Commit message
pub parent_count: usize, // Number of parent commits
}</code></pre>
</div>
<h4>⚙️ EditOptions</h4>
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre><code>pub struct EditOptions {
pub author_name: Option<String>,
pub author_email: Option<String>,
pub timestamp: Option<NaiveDateTime>,
pub message: Option<String>,
}</code></pre>
</div>
<h3>🎛️ Configuration</h3>
<h4>🔧 Environment Variables</h4>
<table>
<thead>
<tr>
<th>Variable</th>
<th>Purpose</th>
<th>Default</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>GIT_EDITOR_NO_BROWSER</code></td>
<td>Disable browser opening for docs</td>
<td>Not set</td>
<td><code>GIT_EDITOR_NO_BROWSER=1</code></td>
</tr>
<tr>
<td><code>NO_BROWSER</code></td>
<td>Alternative browser disable flag</td>
<td>Not set</td>
<td><code>NO_BROWSER=1</code></td>
</tr>
</tbody>
</table>
<h4>📋 Exit Codes</h4>
<table>
<thead>
<tr>
<th>Code</th>
<th>Meaning</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>0</code></td>
<td>Success</td>
<td>Operation completed (including "nothing to change")</td>
</tr>
<tr>
<td><code>1</code></td>
<td>Error</td>
<td>Any failure, printed as <code>Error: …</code> on stderr (or as a JSON error with <code>--json</code>)</td>
</tr>
<tr>
<td><code>2</code></td>
<td>Usage error</td>
<td>Invalid or conflicting arguments</td>
</tr>
<tr>
<td><code>130</code></td>
<td>Cancelled</td>
<td>Declined confirmation, Esc or Ctrl+C</td>
</tr>
</tbody>
</table>
</section>
<footer style="margin-top: 60px; padding-top: 40px; border-top: 2px solid #ddd; text-align: center; color: #666;">
<div style="margin-bottom: 20px;">
<h3 style="color: #34495e; margin-bottom: 15px;">🚀 Git Editor v{{VERSION}}</h3>
<p style="font-size: 0.9em; margin-bottom: 10px;">Generated on {{DATE}}</p>
<p style="font-size: 0.9em;">Made with ❤️ by <strong>Rohan Sen</strong></p>
</div>
<div style="font-size: 0.8em; color: #999;">
<p>This documentation is embedded in the binary at build time and published to GitHub Pages on pushes to master.</p>
<p>For the latest version, visit: <a href="https://github.com/rohansen856/git-editor">github.com/rohansen856/git-editor</a></p>
</div>
</footer>
</div>
<script>
function copyCode(button) {
const codeBlock = button.nextElementSibling.querySelector('code');
const text = codeBlock.textContent;
navigator.clipboard.writeText(text).then(() => {
const originalText = button.textContent;
button.textContent = 'Copied!';
button.classList.add('copied');
setTimeout(() => {
button.textContent = originalText;
button.classList.remove('copied');
}, 2000);
}).catch(err => {
console.error('Failed to copy text: ', err);
button.textContent = 'Copy Failed';
setTimeout(() => {
button.textContent = 'Copy';
}, 2000);
});
}
document.addEventListener('DOMContentLoaded', function() {
const codeBlocks = document.querySelectorAll('pre:not(.code-block pre)');
codeBlocks.forEach(pre => {
if (!pre.parentElement.classList.contains('code-block')) {
const wrapper = document.createElement('div');
wrapper.className = 'code-block';
pre.parentNode.insertBefore(wrapper, pre);
wrapper.appendChild(pre);
const copyBtn = document.createElement('button');
copyBtn.className = 'copy-btn';
copyBtn.textContent = 'Copy';
copyBtn.onclick = function() { copyCode(this); };
wrapper.insertBefore(copyBtn, pre);
}
});
});
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
document.querySelectorAll('h2, h3').forEach(heading => {
if (!heading.id) {
heading.id = heading.textContent.toLowerCase()
.replace(/[^\w\s-]/g, '')
.replace(/\s+/g, '-');
}
});
</script>
</body>
</html>