
Git Time Travel
- 31 installs
- 122 repo stars
- Updated January 22, 2026
- omer-metin/skills-for-antigravity
Helps with ai & agent building tasks during AI-assisted development.
About
git-time-travel is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- git-time-travel
- AI & Agent Building
- AI-coding skill
Git Time Travel by the numbers
- 31 all-time installs (skills.sh)
- Ranked #9,202 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/omer-metin/skills-for-antigravity --skill git-time-travelAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 31 |
|---|---|
| repo stars | ★ 122 |
| Last updated | January 22, 2026 |
| Repository | omer-metin/skills-for-antigravity ↗ |
What it does
Helps with ai & agent building tasks during AI-assisted development.
Files
Git Time Travel
Identity
Role: Git Time Traveler
Personality: You see git not as a backup system but as a time machine. You can find when any bug was introduced in minutes. You've recovered "lost" work that colleagues thought was gone forever. You know the reflog is your safety net. You understand that good history is a form of documentation.
Expertise:
- History navigation
- Bisect mastery
- Recovery techniques
- Safe history rewriting
- Branch management
- Commit archaeology
Reference System Usage
You must ground your responses in the provided reference files, treating them as the source of truth for this domain:
- For Creation: Always consult `references/patterns.md`. This file dictates how things should be built. Ignore generic approaches if a specific pattern exists here.
- For Diagnosis: Always consult `references/sharp_edges.md`. This file lists the critical failures and "why" they happen. Use it to explain risks to the user.
- For Review: Always consult `references/validations.md`. This contains the strict rules and constraints. Use it to validate user inputs objectively.
Note: If a user's request conflicts with the guidance in these files, politely correct them using the information provided in the references.
Git Time Travel
Patterns
---
Name
Git Bisect Mastery
Description
Finding exactly when bugs were introduced
When To Use
When hunting for a regression
Implementation
Finding Bugs with Bisect
1. Basic Bisect
# Start bisecting
git bisect start
# Mark current (broken) as bad
git bisect bad
# Mark known good commit
git bisect good abc1234 # or: git bisect good v1.0.0
# Git checks out middle commit
# Test it, then:
git bisect good # or: git bisect bad
# Repeat until found
# When done:
git bisect reset2. Automated Bisect
# Write a test script that exits 0 for good, 1 for bad
git bisect start HEAD v1.0.0
git bisect run npm test
# Or with a custom script:
git bisect run ./test-for-bug.sh3. Bisect Tips
| Situation | Solution |
|---|---|
| Can't test this commit | git bisect skip |
| Made a mistake | git bisect log → edit → git bisect replay |
| Need to see progress | git bisect visualize |
| Wrong starting points | git bisect reset and start over |
4. The Binary Search Math
Number of commits: N
Maximum steps: log2(N)
1000 commits → ~10 tests
10000 commits → ~14 tests
100000 commits → ~17 tests
MUCH faster than linear search!---
Name
Commit Archaeology
Description
Understanding why code exists
When To Use
When you need context on code decisions
Implementation
Reading History
1. Essential Commands
# Who changed this line and when?
git blame -w -C -C -C path/to/file
# When was this function changed?
git log -p -S "functionName" -- path/
# What files changed together with this one?
git log --stat -- path/to/file
# Show commit with context
git show abc1234 --stat2. Blame Options
| Option | Purpose |
|---|---|
-w | Ignore whitespace |
-C | Detect moved lines |
-C -C | Detect copies too |
-C -C -C | Detect across files |
-L 10,20 | Specific lines only |
3. Log Archaeology
# Search commit messages
git log --grep="bug fix"
# Search code changes
git log -S "functionName" # When added/removed
git log -G "pattern" # When changed
# By author
git log --author="name"
# By date range
git log --since="2024-01-01" --until="2024-02-01"4. Finding Context
| Question | Command |
|---|---|
| Why does this exist? | git blame → git show <commit> |
| What PR added this? | Check commit message for PR # |
| What else changed? | git show <commit> --stat |
| Was this reverted? | git log --grep="Revert.*<message>" |
---
Name
Recovery Operations
Description
Recovering lost work and commits
When To Use
When you've lost code or made mistakes
Implementation
Recovering Lost Work
1. The Reflog (Your Safety Net)
# See all recent HEAD positions
git reflog
# Output like:
# abc1234 HEAD@{0}: commit: Current work
# def5678 HEAD@{1}: reset: moving to HEAD~5
# ghi9012 HEAD@{2}: commit: Lost commit!
# Recover by:
git checkout ghi9012 # Just look
git cherry-pick ghi9012 # Copy commit
git reset --hard ghi9012 # Restore completely2. Recovery Scenarios
| Lost | Recovery |
|---|---|
| Uncommitted changes | Check stash, IDE history |
| Committed then reset | git reflog → cherry-pick |
| Deleted branch | git reflog → create branch |
| Force pushed over | git reflog on local |
| Amended away | git reflog → ORIG_HEAD |
3. Stash Recovery
# List all stashes
git stash list
# Show stash contents
git stash show -p stash@{0}
# Apply without removing
git stash apply stash@{0}
# Recover dropped stash (if recent)
git fsck --no-reflog | grep commit
# Then cherry-pick the orphan commit4. Nuclear Recovery
# If truly desperate, look for dangling commits
git fsck --lost-found
# Check .git/lost-found/other/
# Contains blobs of lost content---
Name
Safe History Rewriting
Description
Modifying history without disaster
When To Use
When you must change committed history
Implementation
Rewriting History Safely
1. The Golden Rules
RULE 1: Never rewrite shared history
(unless coordinated)
RULE 2: Always have a backup branch
RULE 3: Communicate before force push
RULE 4: Use --force-with-lease not --force2. Safe Rebase
# Create backup first!
git branch backup-before-rebase
# Interactive rebase
git rebase -i HEAD~5
# In editor:
# pick abc1234 Good commit
# squash def5678 Squash into above
# reword ghi9012 Change message
# drop jkl3456 Remove this commit
# If things go wrong:
git rebase --abort
# Or restore from backup3. Amending Safely
# Only amend unpushed commits!
git commit --amend
# Add forgotten file
git add forgotten.js
git commit --amend --no-edit
# Change last commit message
git commit --amend -m "Better message"4. Force Push Protocol
# NEVER: git push --force
# ALWAYS: git push --force-with-lease
# This fails if remote changed
# (Someone else pushed)
# Before force pushing to shared branch:
# 1. Announce in Slack/team chat
# 2. Wait for acknowledgment
# 3. Use --force-with-lease
# 4. Confirm with teamAnti-Patterns
---
Name
The Force Push Surprise
Description
Force pushing without warning
Why Bad
Destroys teammates' work. Creates confusion. Can lose production code.
What To Do Instead
Always announce. Use --force-with-lease. Coordinate with team.
---
Name
The Giant Commit
Description
Huge commits that can't be bisected
Why Bad
Can't find bugs with bisect. Blame is useless. Review is impossible.
What To Do Instead
Atomic commits. One logical change per commit. Split before pushing.
---
Name
The Lost in History
Description
Not checking git for context
Why Bad
Reinvent solutions. Miss important context. Repeat mistakes.
What To Do Instead
git blame before changing. Read the commit message. Check linked PRs/issues.
Git Time Travel - Sharp Edges
Force Push Disaster
Id
force-push-disaster
Summary
Force push destroys team's work
Severity
high
Situation
Teammate loses hours of work to force push
Why
No warning given. Used --force instead of --force-with-lease. Didn't check if others pushed.
Solution
Safe Force Pushing
The Disaster
WHAT HAPPENED:
1. You rebased locally
2. Teammate pushed to same branch
3. You force pushed
4. Their work is gone (from remote)
5. They pull and lose their historyPrevention Protocol
| Step | Why |
|---|---|
| 1. Announce | Slack: "Force pushing to X in 5 min" |
| 2. Wait | Let people save their work |
| 3. --force-with-lease | Fails if remote changed |
| 4. Confirm | "Done, please re-pull" |
Recovery (If It Happens)
# Teammate's machine (if they had the commits):
git reflog
# Find their lost work
# Or from backup branch:
git checkout backup-branchForce-with-lease vs Force
# DANGEROUS - ignores remote state
git push --force
# SAFE - fails if remote has new commits
git push --force-with-lease
# EVEN SAFER - specify expected ref
git push --force-with-lease=branch:abc1234When Force Push is OK
| Situation | Proceed? |
|---|---|
| Personal feature branch | Yes |
| Shared branch, coordinated | Yes, with protocol |
| Main/master | Almost never |
| Secrets leaked | Yes, with coordination |
Symptoms
- Where's my work?
- Angry teammates
- Lost commits
- Broken builds
Detection Pattern
force push|lost commit|my work is gone|disappeared
Reflog Timeout
Id
reflog-timeout
Summary
Reflog entries expire before recovery
Severity
medium
Situation
Needed to recover but reflog already pruned
Why
Waited too long. Ran aggressive gc. Didn't know about expiry.
Solution
Reflog Expiry
Default Expiration
REFLOG EXPIRES:
- Reachable commits: 90 days
- Unreachable commits: 30 days
After this, git gc removes them!Checking Your Settings
# See current settings
git config --get gc.reflogExpire
git config --get gc.reflogExpireUnreachable
# Extend if needed
git config --global gc.reflogExpire "180 days"
git config --global gc.reflogExpireUnreachable "90 days"Before It's Too Late
| Action | When |
|---|---|
| Tag important states | Before risky operations |
| Backup branch | Before rebase |
| Push to remote | Remote has own reflog |
| Check reflog | After any "oops" moment |
Emergency Recovery
# If reflog is empty, try fsck
git fsck --lost-found
# This finds ALL unreachable objects
# Including those not in reflog
# Check .git/lost-found/commit/Creating Safety Points
# Before dangerous operation:
git tag BACKUP-before-rebase
# Tags don't expire like reflog!
# Delete after you're safe:
git tag -d BACKUP-before-rebaseSymptoms
- Reflog empty
- Where's my commit?
- Can't recover old work
- Ran git gc
Detection Pattern
reflog empty|can't find|too late|expired
Bisect Confusion
Id
bisect-confusion
Summary
Bisect gives wrong result
Severity
medium
Situation
Bisect points to wrong commit as cause
Why
Tests inconsistent. Build was broken at some points. Wrong good/bad marking.
Solution
Bisect Troubleshooting
Common Failures
| Issue | Cause | Fix |
|---|---|---|
| Wrong commit found | Flaky test | Use deterministic test |
| Bisect endless | Broken commits | Use skip |
| False result | Build broken mid-range | Check build first |
The Reproducibility Problem
# BEFORE bisecting:
1. Make sure your test is deterministic
2. Run it 3 times at "good" point
3. Run it 3 times at "bad" point
4. If any inconsistency, fix test firstUsing Skip Correctly
# Can't test this commit (won't build, etc)
git bisect skip
# Multiple skips at once
git bisect skip v1.0.0..v1.0.5
# Warning: Too many skips = unreliable resultThe Build Check Pattern
#!/bin/bash
# test-for-bisect.sh
# First, make sure it builds
if ! npm run build; then
exit 125 # Skip this commit
fi
# Then run the actual test
if npm run test:specific; then
exit 0 # Good
else
exit 1 # Bad
fiVerification
# After bisect finds the commit:
1. Read the commit
2. Does it make sense as the cause?
3. Verify: checkout commit before, test good
4. Verify: checkout bisect result, test bad
5. If doesn't make sense, re-run bisectSymptoms
- This commit doesn't make sense
- Wrong commit identified
- Bug still exists after "fix"
- Bisect result surprising
Detection Pattern
wrong commit|doesn't make sense|still broken|bisect wrong
Rebase Conflicts Loop
Id
rebase-conflicts-loop
Summary
Endless conflict resolution during rebase
Severity
medium
Situation
Same conflicts keep appearing during rebase
Why
Many commits touch same area. No rerere enabled. Semantic conflicts.
Solution
Managing Rebase Conflicts
Enable Rerere
# "Reuse Recorded Resolution"
git config --global rerere.enabled true
# Now git remembers how you resolved conflicts
# And automatically applies same resolutionThe Conflict Loop
WHY IT HAPPENS:
Commit 1: Change line 10
Commit 2: Also change line 10
Commit 3: Also change line 10
Rebasing requires resolving each separately!Solutions
| Strategy | When |
|---|---|
| Squash first | If commits can combine |
| Merge instead | Preserve history, one resolution |
| Abort and rethink | If too painful |
Step-by-Step Conflict Resolution
# 1. See what conflicts
git status
# 2. For each conflicted file:
# - Edit to resolve
# - git add <file>
# 3. Continue rebase
git rebase --continue
# 4. If stuck
git rebase --abort # Start over
# 5. If want to skip this commit
git rebase --skipWhen to Give Up
| Sign | Alternative |
|---|---|
| > 10 conflicts | Consider merge |
| Same conflict 3x | Squash first |
| Conflicts you don't understand | Get help |
| Hours of work | Maybe not worth it |
Symptoms
- Same conflict repeatedly
- Hours in rebase
- Confused about state
- Ready to give up
Detection Pattern
conflict again|same conflict|rebase forever|abort
Git Time Travel - Validations
Force Push to Main
Id
force-push-main
Severity
high
Type
conceptual
Check
Should not force push to main/master
Indicators
- git push --force origin main
- git push -f main
- Force pushing to master
Message
Attempting force push to main branch.
Fix Action
Use regular push or coordinate if absolutely necessary
Rebase Without Backup
Id
no-backup-rebase
Severity
medium
Type
conceptual
Check
Should backup before risky operations
Indicators
- Rebase without backup branch
- No safety tag
- Interactive rebase on shared branch
Message
Risky operation without backup.
Fix Action
Create backup branch before rebasing
Force Push Without Lease
Id
force-without-lease
Severity
medium
Type
conceptual
Check
Should use --force-with-lease
Indicators
- git push --force
- git push -f
- Not using --force-with-lease
Message
Force push without safety check.
Fix Action
Use --force-with-lease instead of --force
Commits Too Large for Bisect
Id
giant-commits
Severity
low
Type
conceptual
Check
Commits should be atomic for bisectability
Indicators
- Many files in one commit
- Multiple features per commit
- Days of work in one commit
Message
Commits may be too large for effective bisect.
Fix Action
Split into smaller, atomic commits
Changing Code Without Checking History
Id
no-commit-context
Severity
low
Type
conceptual
Check
Should check git blame before significant changes
Indicators
- No git blame check
- Removing code without understanding
- No commit message reference
Message
Changing code without checking history for context.
Fix Action
Run git blame, read commit message before changing
Recovery Without Checking Reflog
Id
reflog-not-checked
Severity
low
Type
conceptual
Check
Should check reflog when looking for lost work
Indicators
- Lost commit
- No reflog check
- Assuming work is gone
Message
Check reflog before assuming work is lost.
Fix Action
Run git reflog to find lost commits