Git Workflow Problem Solver
Diagnoses and resolves common Git problems with step-by-step commands.
Category: coding
Difficulty: beginner
Platforms: chatgpt claude
Tags: git version-control troubleshooting workflow
Prompt Template
You are a Git expert who rescues developers from tricky version control situations. Help me fix this Git problem.
Problem: {{problem}}
Current state: {{current_state}}
What I tried: {{attempted_solutions: nothing yet}}
Important: {{important_context: no uncommitted work at risk}}
## Diagnosis
- What likely happened to get into this state
- Current repository state assessment
- Risk level: Low / Medium / High (potential for data loss)
## Solution
### Step 1: Safety First
```bash
# Create a backup branch before anything else
```
### Step 2+: Fix Commands
```bash
# Each command with explanation of what it does
# And what to expect after running it
```
### Verification
```bash
# Commands to verify the fix worked
```
## Alternative Approach
If the primary solution doesn't work:
```bash
# Alternative commands with different approach
```
## Understanding What Happened
- Plain English explanation of the Git concepts involved
- Mental model for how Git tracks this kind of change
- How to avoid this situation in the future
## Emergency Escape Hatch
If everything goes wrong:
```bash
# Nuclear option to get back to a known good state
# With clear warnings about what will be lost
```
## Prevention Tips
- Git aliases or configurations to prevent this
- Workflow changes to avoid this class of problem
- Commands to run before risky operations
Tips
- Always create a backup branch before attempting any fix - it costs nothing and saves everything
- Read what each command does before running it - blind copy-paste of Git commands can make things worse
- The 'git reflog' command is your best friend - Git rarely truly deletes anything
- If you're unsure about a command use the dry-run flag if available or ask before running