Version control, down to the code.
Restore individual blocks of code without reverting entire files. CapState gives developers granular control over their code history.
The Problem
Sometimes you don't want to go back.
You just want one thing back.
Traditional version control forces an all-or-nothing choice. Revert the whole file and lose your latest work, or keep everything and manually reconstruct the old code.
Traditional Git Workflow
6 painful steps
Current file
Working on latest version
Something broke
Tax logic fails in production
Find older version
Dig through commit history
Restore entire file
Revert all changes
Lose newer work
3 hours of progress gone
Manually reconstruct
Piece it back together
CapState Workflow
4 clean steps
Current file
Working on latest version
Something broke
Tax logic fails in production
Select the block
calculatePrice() at 2:41 PM
Restore only that
Everything else untouched
2 fewer steps. 0 lost work.
✓ Everything else preserved
Don't roll back the file. Roll back the code.
How It Works
Restore what changed. Keep what didn't.
Four steps from broken code to working code — without touching a single line you didn't write today.
Capture
Tag individual functions, classes, or components for tracking. CapState begins recording every change at the block level from that moment forward.
// capstate.config.ts
export default {
track: [
"calculatePrice",
"UserAuthService",
"PaymentHandler"
]
}Track
Each tracked code block develops its own independent timeline. Changes to other parts of the file don't pollute your block's history.
calculatePrice() history
09:14
Initial impl
11:32
Added caching
14:41
Tax logic v1
16:08
Tax logic v2
Compare
Inspect any two versions of a block side by side. Understand precisely what shifted between implementations.
// diff: calculatePrice- const tax = applyTaxLogic(base);+ const tax = base * 0.18; const discount = getDiscount(base);
Restore
One command. The block reverts. Everything else in the file stays exactly as you left it.
$ capstate restore calculatePrice@2:41pm✓ Restored calculatePrice (v2 → v1)✓ 847 other lines untouched
Developer Workflow
Every block type, covered.
CapState tracks history at the level you actually think about code — not files, not commits, but the blocks that matter.
Pure functions & utilities
Restore any standalone function to a previous working state without touching the module it lives in.
function calculateDiscount(
price: number,
tier: UserTier
): number {
// v1: simple percentage
return price * 0.1;
}UI components
Broke a component refactor? Restore the component tree to any point in its history, keeping your other components intact.
export function PriceTag({ amount }: Props) {
return (
<span className="price">
{formatCurrency(amount)}
</span>
);
}Route & request handlers
API endpoints evolve fast. Restore a specific handler to a known-good version while your new endpoints stay live.
app.post('/api/checkout', async (req, res) => {
const { items, userId } = req.body;
const order = await createOrder(items);
res.json({ orderId: order.id });
});Core logic & algorithms
Performance regression in a sorting or search algorithm? Roll back the logic without touching the data layer.
function rankResults(
results: SearchResult[]
): SearchResult[] {
return results
.sort((a, b) => b.score - a.score)
.slice(0, 20);
}Classes & services
Service classes grow complex. Restore an individual method or the entire class body to a previous checkpoint.
class PaymentService {
async charge(
amount: number,
method: PaymentMethod
): Promise<Receipt> {
return this.gateway.process(amount);
}
}Config & feature flags
Revert a misconfigured feature flag or build config block independently of everything else in the file.
export const featureFlags = {
newCheckout: true,
betaPricing: false,
darkMode: true,
experimentalAPI: false,
};12+
Active developers
250+
Blocks tracked
99.8%
Restore accuracy
< 10s
Avg recovery time
What developers say
“CapState changed how I debug. I stopped dreading refactors because I know I can restore any function to exactly how it was — not the whole file, just that one block.”
Priya Venkataraman
Senior Engineer — Razorpay
Impact in numbers
3.2h
saved per week
$ capstate restore calculatePrice@2:41pm
✓ Block restored in 8.2s
✓ 847 other lines untouched
▌
Get Started Today
Stop reverting files. Start restoring code.
Join 12+ developers who've stopped losing work to file-level reverts. Install in 30 seconds, start tracking in under a minute.
- Free forever for solo devs
- No credit card required
- CLI + VS Code extension
- Works with any git repo
$ npm install -g capstate
$ capstate init
✓ CapState initialized in ./src
Tracking 0 blocks. Run capstate add to start.
$ capstate add calculatePrice
✓ Now tracking calculatePrice▌
30s
to install
1 cmd
to restore
0 deps
required