0Pricing
Git Advanced: Monorepo, Submodules & Workflows · 강의

Reflog와 Stash로 작업 복구하기

Git의 안전망을 익힙니다. Reflog로 잘못된 리셋과 리베이스에서 복구하고, Stash로 복구 중인 작업을 안전하게 보관하고 다시 불러옵니다.

Reflog와 Stash로 작업 복구하기은(는) CoddyKit의 무료 Git Advanced: Monorepo, Submodules & Workflows 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Git Advanced: Monorepo, Submodules & Workflows 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Git Advanced: Monorepo, Submodules & Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Git Rarely Loses Data

It feels like a bad reset or rebase destroys work, but Git almost never truly loses commits. They become unreachable, not deleted, and remain recoverable for weeks.

The reflog is your map back to them.

What the Reflog Records

The reflog logs every move of HEAD and branch tips: commits, checkouts, resets, rebases, merges. It is local and not shared, a private diary of where your refs have been.

git reflog
# a1b2c3d HEAD@{0}: reset: moving to HEAD~3
# 9f8e7d6 HEAD@{1}: commit: add feature

Recovering After a Bad Reset

Ran git reset --hard and lost commits? Find the pre-reset SHA in the reflog and reset back to it.

git reflog
git reset --hard HEAD@{1}

Recovering After a Bad Rebase

A rebase rewrites commits. If it went wrong, the reflog still holds the pre-rebase tip. Point your branch back at it.

git reflog
git reset --hard HEAD@{5}  # the entry just before 'rebase'

Restoring a Single Lost Commit

You do not always want to reset the whole branch. To resurrect just one commit, cherry-pick its SHA from the reflog.

git cherry-pick 9f8e7d6

The Stash as a Safety Net

Before risky recovery operations, save uncommitted work with git stash. It tucks changes away cleanly so you can experiment without losing them.

git stash push -m 'wip before recovery'

Inspecting and Restoring Stashes

List stashes and bring one back. apply keeps it in the list; pop restores and removes it.

git stash list
git stash show -p stash@{0}
git stash pop stash@{0}

Recovering Dropped Stashes

Dropped a stash by mistake? Stashes are commits too. Find the dangling commit and re-apply it.

git fsck --no-reflogs | grep commit
git stash apply <dangling-sha>

Finding Orphans with fsck

When even the reflog does not show it, git fsck --lost-found hunts for dangling commits and blobs, the last-resort recovery tool.

git fsck --lost-found

The Garbage Collection Clock

Unreachable objects survive until garbage collection prunes them, by default after about 30 days for reflog entries. Recover promptly; do not let weeks pass before you go looking.

The Reflog Is Local Only

Remember: the reflog lives only in your clone. A teammate's reflog will not show your moves, and a fresh clone has none. If you need shared recoverability, push branches or tags before risky operations.

Quick Check

Test your understanding of Git recovery tools.

Recap

You learned Git's safety nets: the reflog recovers from bad resets and rebases, cherry-pick restores single lost commits, the stash protects work-in-progress, fsck hunts dangling objects, and the GC clock means you should recover promptly. Git rarely loses data if you know where to look.

자주 묻는 질문

“Reflog와 Stash로 작업 복구하기” 강의는 무료인가요?

네 — “Reflog와 Stash로 작업 복구하기” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Git Advanced: Monorepo, Submodules & Workflows 강의 전체를 잠금 해제할 수 있습니다. Git Advanced: Monorepo, Submodules & Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

“Reflog와 Stash로 작업 복구하기”에서 뭘 배우나요?

Git의 안전망을 익힙니다. Reflog로 잘못된 리셋과 리베이스에서 복구하고, Stash로 복구 중인 작업을 안전하게 보관하고 다시 불러옵니다. 브라우저에서 직접 실행하는 실습 코드로 Git Advanced: Monorepo, Submodules & Workflows을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Git Advanced: Monorepo, Submodules & Workflows을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Git Advanced: Monorepo, Submodules & Workflows은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“Reflog와 Stash로 작업 복구하기” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Git Advanced: Monorepo, Submodules & Workflows 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Git Advanced: Monorepo, Submodules & Workflows 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 손실된 커밋과 브랜치 복구
  2. Git Bisect로 디버깅
  3. Git 저장소 성능 최적화
  4. Reflog와 Stash로 작업 복구하기
← Git Advanced: Monorepo, Submodules & Workflows(으)로 돌아가기