Instruction file imported from SOULRIGHT/child-learning-center (
.cursor/rules/emergency-rollback-guide.mdc). Copyright stays with the author.
π¨ Emergency Rollback Guide
β‘ μ¦μ μ€ν - μμ€ν μ 체 μ€λ₯ μ
π΄ CRITICAL: μλ²κ° μμλμ§ μλ κ²½μ°
# 1. μ¦μ λͺ¨λ λ³κ²½μ¬ν μ€νμ
git stash push -m "Emergency stash - $(date)"
# 2. λ§μ§λ§ μ μ 컀λ°μΌλ‘ λ‘€λ°±
git reset --hard HEAD~1
# 3. μλ² μμ ν
μ€νΈ
python app.py
π΄ CRITICAL: νΉμ νμ΄μ§κ° μλνμ§ μλ κ²½μ°
# 1. λ¬Έμ νμΌλ§ λ‘€λ°±
git checkout HEAD -- templates/children/detail.html
git checkout HEAD -- app.py
# 2. μ¦μ ν
μ€νΈ
python -m py_compile app.py
python app.py
π‘οΈ λ¨κ³λ³ 볡ꡬ μ μ°¨
Step 1: νμ¬ μν μ§λ¨
# Python λ¬Έλ² μ€λ₯ νμΈ
python -m py_compile app.py 2>&1 | head -5
# μλ² μμ κ°λ₯ μ¬λΆ νμΈ
timeout 5 python app.py 2>&1 | grep -E "(ERROR|Traceback)" | head -3
Step 2: λ°±μ μν νμΈ
# μ΅κ·Ό λ°±μ
λΈλμΉ νμΈ
git branch | grep backup | tail -3
# μ΅κ·Ό μ μ μ»€λ° νμΈ
git log --oneline -5
Step 3: μ νμ λ‘€λ°±
# νΉμ νμΌλ§ λ‘€λ°± (κΆμ₯)
git checkout HEAD~1 -- app.py
# λλ μ 체 λ‘€λ°± (μ΅ν μλ¨)
git reset --hard HEAD~1
π νμΌλ³ μκΈ λ³΅κ΅¬ λ°©λ²
app.py μ€λ₯ μ:
# 1. λ°±μ
μμ 볡ꡬ
cp app.py.backup.* app.py # λ°±μ
μ΄ μλ κ²½μ°
# 2. λλ Gitμμ 볡ꡬ
git show HEAD~1:app.py > app.py
# 3. κ²μ¦
python -m py_compile app.py
ν νλ¦Ώ νμΌ μ€λ₯ μ:
# 1. ν΄λΉ ν
νλ¦Ώλ§ λ‘€λ°±
git checkout HEAD -- templates/children/detail.html
# 2. λλ λ°±μ
μμ 볡ꡬ
cp templates/children/detail.html.backup templates/children/detail.html
# 3. λΈλΌμ°μ μμ ν
μ€νΈ
curl -s http://localhost:5000/children/1 | grep "<!DOCTYPE"
JavaScript μ€λ₯ μ:
# 1. static/js νμΌ λ‘€λ°±
git checkout HEAD -- static/js/script.js
# 2. λΈλΌμ°μ μΊμ ν΄λ¦¬μ΄ ν ν
μ€νΈ
# Ctrl+F5 λλ Ctrl+Shift+R
π μ€λ₯ μμΈ μ μ μ§λ¨
Python μ€λ₯ ν¨ν΄:
# λ€μ¬μ°κΈ° μ€λ₯
python -m py_compile app.py 2>&1 | grep -i "indent"
# Import μ€λ₯
python -m py_compile app.py 2>&1 | grep -i "import"
# λ¬Έλ² μ€λ₯
python -m py_compile app.py 2>&1 | grep -i "syntax"
λ°μ΄ν°λ² μ΄μ€ μ°κ²° μ€λ₯:
# λ°μ΄ν°λ² μ΄μ€ νμΌ μ‘΄μ¬ νμΈ
ls -la *.db
# Flask-SQLAlchemy ν
μ€νΈ
python -c "
from app import app, db
with app.app_context():
print('DB connection OK')
"
π 볡ꡬ μ±κ³΅ κ²μ¦ 체ν¬λ¦¬μ€νΈ
β κΈ°λ³Έ μμ€ν λμ:
-
python -m py_compile app.pyμ±κ³΅ -
python app.pyμλ² μμ μ±κ³΅ - λ©μΈ νμ΄μ§ (
/) μ κ·Ό κ°λ₯ - λ‘κ·ΈμΈ νμ΄μ§ μ κ·Ό κ°λ₯
β ν΅μ¬ κΈ°λ₯ λμ:
- λμ보λ νμ΄μ§ λ λλ§
- μλ λͺ©λ‘ νμ΄μ§ λ λλ§
- ν¬μΈνΈ μ λ ₯ νμ΄μ§ λ λλ§
- λ°μ΄ν°λ² μ΄μ€ μ½κΈ°/μ°κΈ° μλ
β λ¬Έμ ν΄κ²° νμΈ:
- μ΄μ μ λ°μνλ μ€λ₯ λ©μμ§ ν΄κ²°
- JavaScript μ½μ μ€λ₯ μμ
- λͺ¨λ λ²νΌκ³Ό λ§ν¬ μ μ μλ
π 볡ꡬ ν μμ ν μ¬μμ μ μ°¨
1. μμ ν λΈλμΉ μμ±:
# 볡ꡬ μλ£ ν μλ‘μ΄ μμ
λΈλμΉ μμ±
git checkout -b fix/step-by-step-$(date +%Y%m%d)
2. λ¨κ³λ³ μ¬μμ :
# μμ λ¨μλ‘ μμ β κ²μ¦ β μ»€λ° λ°λ³΅
# μ: ν¨μ 1κ°μ© μμ
git add app.py
git commit -m "Fix: νΉμ ν¨μ λ€μ¬μ°κΈ° μμ "
python -m py_compile app.py # κ²μ¦
3. μ κΈ°μ λ°±μ :
# μ€μν λ¨κ³λ§λ€ λ°±μ
μμ±
cp app.py app.py.backup.$(date +%Y%m%d_%H%M%S)
git tag backup-$(date +%Y%m%d-%H%M%S)
π μ΅ν μλ¨ - μμ μ΄κΈ°ν
μ¬κ°ν μμμΌλ‘ 볡ꡬ λΆκ°λ₯ν κ²½μ°:
# 1. νμ¬ μμ
μμ λ°±μ
git stash push -m "Complete backup before reset"
git tag emergency-backup-$(date +%Y%m%d-%H%M%S)
# 2. μ격 μ μ₯μμ μμ ν μνλ‘ μ΄κΈ°ν
git fetch origin
git reset --hard origin/main
# 3. κ°μ ν΄λ¦°μ
git clean -fd
# 4. μμ‘΄μ± μ¬μ€μΉ
pip install -r requirements.txt
# 5. λ°μ΄ν°λ² μ΄μ€ μ¬μ΄κΈ°ν (νμμ)
python -c "
from app import app, db
with app.app_context():
db.create_all()
print('Database reset complete')
"
π μκΈ μν© μ°λ½μ²
μ€λ₯ λ°μ μ μ¦μ μνν κ²:
- μμ μ€λ¨ - μΆκ° μμ μ λ κΈμ§
- μν λ°±μ
-
git stashλλ νμΌ λ³΅μ¬ - λ‘€λ°± μ€ν - μμ μ μ°¨ λ°λΌ 볡ꡬ
- κ²μ¦ μλ£ - μ μ μλ νμΈ ν μμ μ¬κ°
볡ꡬ λΆκ° μ:
- μ 체 μ΄κΈ°ν κ³ λ €
- λ°±μ λΈλμΉμμ μ¬μμ
- μ΄μ μμ λ²μ μΌλ‘ λλ리기
π‘ μλ°©μ μν κ΅ν
μ΄λ² μ¬κ³ μμ λ°°μ΄ μ :
- λλ μμ κΈμ§ - ν λ²μ μ¬λ¬ νμΌ μμ νμ§ μκΈ°
- λ¨κ³λ³ κ²μ¦ - κ° μμ ν μ¦μ ν μ€νΈ
- λ°±μ νμ - μνν μμ μ λ°λμ λ°±μ
- μ μ§μ μ κ·Ό - μμ λ¨μλ‘ λλμ΄ μμ
μμΌλ‘ μ§μΌμΌ ν μμΉ:
- Safety First - μλλ³΄λ€ μμ μ± μ°μ
- Test Early - λ¦μ ν μ€νΈλ λΉμΌ ν μ€νΈ
- Backup Always - λ°±μ μλ μμ κΈμ§
- One Step - ν λ²μ νλμ©λ§ μμ
π¨ κΈ°μ΅νμΈμ: μ΄ κ°μ΄λλ μκΈμν©μμ λΉ λ₯Έ 볡ꡬλ₯Ό μν κ²μ λλ€. 볡ꡬ μλ£ νμλ λ°λμ μμΈ λΆμμ ν΅ν΄ μ¬λ° λ°©μ§ λμ± μ μ립νμΈμ!