Rollback (Git)
Use this prompt when critical issues arise that cannot be quickly fixed forward and you need to restore the codebase to a known stable state. Instead of manually executing complex git commands that could permanently delete work if done incorrectly, this prompt guides an LLM agent through a safe, documented rollback procedure with built-in safety checks. The LLM will automatically create a backup of the current state before rolling back, stop for your approval before force-pushing, and provide verification at each step—preventing the costly mistakes that often occur during high-pressure emergency situations when you're trying to restore production systems.
Here's the prompt:
# LLM Prompt: Rollback to Last Stable Checkpoint
```
I need you to perform a rollback of the {{{YOUR APPLICATION NAME}}} develop branch to the last stable checkpoint. This is an emergency rollback procedure due to critical issues that cannot be quickly fixed forward.
## Current Situation
- The develop branch has critical issues that are blocking progress
- We need to rollback to the last known stable state
- We have a documented stable checkpoint that we need to restore
## Checkpoint Information
Please reference the file `docs/ROLLBACK_PROCEDURES.md` to find the "Current Stable Backup Points" section which contains:
- Tag name (format: v[VERSION]-stable)
- Branch name (format: backup/pre-[feature]-YYYY-MM-DD)
- Commit hash
- Project status at that point
## Your Task
Follow these steps carefully:
1. **Read the Documentation First**
- Read `docs/ROLLBACK_PROCEDURES.md` completely
- Identify the latest stable checkpoint from the "Current Stable Backup Points" section
- Note the backup branch name and tag name
2. **Create a Safety Backup of Current State**
Before doing ANY rollback, create a backup of the current develop state:
```bash
git checkout develop
git branch develop-pre-rollback-$(date +%Y%m%d-%H%M%S)
git push origin develop-pre-rollback-$(date +%Y%m%d-%H%M%S)
```
3. **Perform the Rollback Using Method 1 (Hard Reset)**
Use the backup branch name you found in ROLLBACK_PROCEDURES.md:
```bash
git checkout develop
git fetch origin
git reset --hard [BACKUP_BRANCH_NAME]
```
STOP HERE - Do NOT force push yet. Show me what you're about to do.
4. **Show Me the Changes**
Before force pushing, show me:
- The current HEAD commit after reset
- Confirmation of which backup point we're at
- Summary of what will be lost (commits between backup and current state)
5. **Wait for My Approval**
I will review the information and explicitly tell you to proceed with the force push.
6. **Force Push (Only After My Approval)**
```bash
git push origin develop --force
```
7. **Verify the Rollback**
After force push, verify:
```bash
git log -1 --oneline
git status
```
8. **Follow Post-Rollback Procedures**
Reference the "Post-Rollback Procedures" section in `docs/ROLLBACK_PROCEDURES.md` and:
- Verify application functionality
- Confirm test suites pass
- Check database migration status
- Provide me with a summary of what needs to be done next
## Important Safety Requirements
- ⚠️ NEVER skip the safety backup of current develop state
- ⚠️ NEVER force push without showing me the changes first and getting explicit approval
- ⚠️ ALWAYS read ROLLBACK_PROCEDURES.md before starting
- ⚠️ ALWAYS verify you're using the correct backup branch/tag name
- ⚠️ STOP before force push and wait for my confirmation
## Expected Deliverables
After completing the rollback:
1. Confirmation that rollback was successful
2. Summary of what was rolled back (commit range)
3. Current commit hash and message
4. List of next steps from post-rollback procedures
5. Recommendation on how to proceed
## Questions to Ask Me
Before starting, ask me:
- Do you want to proceed with this rollback? (Yes/No)
- Is there any specific data or state we need to preserve?
- Should we notify anyone before performing this operation?
Please start by reading `docs/ROLLBACK_PROCEDURES.md` and confirming you understand the task.
```
---
## Usage Instructions
1. **When to Use This Prompt:**
- Critical bugs blocking all progress
- Security vulnerabilities discovered
- Database corruption or migration failures
- Performance issues making application unusable
- Multiple test suites failing with no quick fix
2. **How to Use:**
- Copy the entire prompt from the code block above
- Paste it into your LLM conversation
- Answer the LLM's questions before it proceeds
- Review the changes before approving force push
3. **What This Prompt Does:**
- Instructs the LLM to read documentation first
- Creates a safety backup before rollback
- Performs rollback using hard reset method
- Requires your approval before force push
- Verifies the rollback succeeded
- Provides next steps
4. **Safety Features:**
- Creates backup of current state before rollback
- Stops before destructive operations
- Requires explicit approval for force push
- Verifies each step
- References official documentation
---
## Alternative Scenarios
### If You Want a Safer Rollback (Preserving History)
Replace Step 3 in the prompt with:
```
3. **Perform the Rollback Using Method 3 (Revert - Preserves History)**
```bash
git log [BACKUP_BRANCH_NAME]..develop --oneline
# Show me this output first, then I'll confirm to proceed with reverts
```
```
### If You Want to Test Before Committing
Replace Step 3 in the prompt with:
```
3. **Perform the Rollback Using Method 4 (New Branch - Safest)**
```bash
git checkout -b develop-rollback-candidate [BACKUP_BRANCH_NAME]
# Test this branch thoroughly before replacing develop
```
```
---
## Prompt Variations by Urgency
### Emergency Rollback (Use as-is above)
- Fastest method
- Hard reset with force push
- Use when time is critical
### Cautious Rollback (Add these modifications)
Add after Step 3:
```
3a. **Test the Rollback State**
- Run test suites to verify stability
- Check application starts correctly
- Verify database migrations
- Only proceed if all tests pass
```
### Team Coordination Rollback (Add these requirements)
Add to "Questions to Ask Me":
```
- Have you notified the team about this rollback?
- Are there any team members currently working on develop?
- Should we create a communication plan before proceeding?
```
---
## Example Conversation Flow
**You paste the prompt, then:**
**LLM:** "I've read `docs/ROLLBACK_PROCEDURES.md`. I found the latest stable checkpoint:
- Tag: v0.29.0-stable
- Branch: backup/pre-video-tutorials-2025-01-17
- Commit: 3dbce578
Before proceeding, do you want to perform this rollback? (Yes/No)"
**You:** "Yes"
**LLM:** "Creating safety backup..." [creates backup] "Safety backup created: develop-pre-rollback-20250117-143022"
**LLM:** "I'm about to reset develop to backup/pre-video-tutorials-2025-01-17. This will remove 15 commits from develop. Current HEAD: abc123def, Target HEAD: 3dbce578. Should I proceed with force push? (Yes/No)"
**You:** "Yes"
**LLM:** "Force push completed. Rollback successful. Current commit: 3dbce578..."
---
## Post-Rollback Checklist
After LLM completes the rollback, verify:
- [ ] Develop branch is at expected commit
- [ ] Application starts without errors
- [ ] Tests pass
- [ ] Database is in sync
- [ ] Team is notified
- [ ] Incident report created
- [ ] Forward-fix plan documented
---
**Last Updated:** January 17, 2025
**Related Files:**
- [ROLLBACK_PROCEDURES.md](../ROLLBACK_PROCEDURES.md) - Complete rollback documentation
- [CREATING_STABLE_CHECKPOINTS.md](../CREATING_STABLE_CHECKPOINTS.md) - How to create new checkpoints
1
2 comments
Warren Bullock
3
Rollback (Git)
powered by
The Automated StudyHall (Beta)
skool.com/the-automated-1108
A learning community for entrepreneurs in the age of AI: explore AI and strategy, share ideas, test experiments, and turn insight into action.
Build your own community
Bring people together around your passion and get paid.
Powered by