git statusTranslates the results of the related commands into natural Korean that non-developers can understand.
Execution Order
Step 1: Parallel Status Collection
Run the following commands in parallel :
git rev-parse --is-inside-work-tree # .git 존재 확인
git symbolic-ref --short HEAD # 현재 branch (detached HEAD 감지)
git status --porcelain # 변경 파일 목록
git log --oneline -3 # 최근 저장 기록 3개
git remote -v # 원격 연결 상태
Step 2: Safety Check
Check in priority order, and if a problem is found, immediately notify and stop:
.gitNone: "This isn't a Git project folder. Please set it up first with 'start Git'."- Detached HEAD: "You've left a safe location. I'll return automatically." →
git checkout main(or master) run - Merge Conflict (
UU,AA, etc.): show the list of conflicted files, and present resolution options with AskUserQuestion:
Depending on the choice:두 사람이 같은 파일의 같은 부분을 동시에 고쳐서 충돌이 생겼어요. 충돌 파일: {파일 목록} 어떻게 할까요? 1. "내가 수정한 걸로 유지" — 내 변경 내용을 사용해요 2. "상대방이 수정한 걸로 유지" — 상대방의 변경 내용을 사용해요- "Keep mine":
git checkout --ours {파일}→git add {파일} - "Keep theirs":
git checkout --theirs {파일}→git add {파일}After resolving the conflict, guide the next step with "save".
- "Keep mine":
Step 3: Status Translation
git status --porcelain Translate the result into natural language:
| Porcelain code | Natural language translation |
|---|---|
M (modified) |
Modified |
A (added) |
Newly added |
D (deleted) |
Deleted |
R (renamed) |
Renamed |
?? (untracked) |
New file (a file Git doesn't know about yet) |
Step 4: Output Results
Output format by situation:
When there are changes
현재 상태:
변경된 파일 3개:
- index.html (수정됨)
- style.css (새 파일)
- old-logo.png (삭제됨)
아직 저장(Commit)하지 않은 상태예요.
저장하려면 "저장해줘"라고 하세요.
When saved but not pushed
현재 상태:
저장(Commit)은 되어 있지만, 아직 내 컴퓨터에만 있어요.
GitHub에 올리지 않은 저장이 2개 있어요:
- "로고 변경" (10분 전)
- "메인 페이지 수정" (30분 전)
클라우드에 올리려면 "올려줘"라고 하세요.
When everything is clean
현재 상태: 깨끗해요!
모든 변경 내용이 저장되고 GitHub에도 올라가 있어요.
마지막 저장: "로고 변경" (10분 전)
When there is no remote connection
현재 상태:
이 폴더는 Git으로 관리되고 있지만, GitHub에 연결되어 있지 않아요.
연결하려면 "깃 시작해줘"라고 하세요.
Step 5: Branch Status Guidance
Also translate the current branch information into natural language.
git branch --show-current
git log --oneline origin/{branch}..HEAD 2>/dev/null # 올리지 않은 저장
git log --oneline HEAD..origin/{branch} 2>/dev/null # 내려받지 않은 변경
Output by branch status
When on the main/master branch
현재 위치: main (기본 브랜치)
When on a separate branch
현재 위치: feature/add-login (작업 브랜치)
기본 브랜치(main)에서 분기된 상태예요.
When there are saves that haven't been pushed
GitHub에 올리지 않은 저장이 2개 있어요:
- "로그인 기능 추가" (10분 전)
- "스타일 수정" (30분 전)
When there are new changes on GitHub
GitHub에 아직 내려받지 않은 변경이 1개 있어요.
최신 상태로 맞추려면 "내려받아줘"라고 하세요.
Step 6: Check Stash Status
git stash list
If there is a stash, provide guidance:
임시로 보관 중인 변경 내용이 1개 있어요:
- "작업 중이던 헤더 수정" (3일 전)
복원하려면 알려주세요.
Handling Composite States
When multiple states exist at the same time, show the most important one first according to priority.
Priority
- Conflict (needs immediate resolution)
- Detached HEAD (dangerous state)
- Has changes (recommend saving)
- Saved but not pushed (recommend pushing)
- New changes on GitHub (recommend pulling)
- Clean (everything is normal)
Example of composite status output
현재 상태:
⚠ 변경된 파일 2개:
- index.html (수정됨)
- style.css (새 파일)
또한, GitHub에 올리지 않은 이전 저장이 1개 있어요:
- "로고 변경" (1시간 전)
먼저 "저장해줘"로 현재 변경을 저장한 뒤,
"올려줘"로 모든 저장을 GitHub에 올리세요.
Next Action Guidance
At the end of all status results, guide the next action:
| Status | Guidance |
|---|---|
| Has changes | "To save, say 'save'" |
| Saved only | "To upload to GitHub, say 'upload it'" |
| Clean | "All changes are saved and uploaded" |
| Conflict | Present conflict resolution options |
| New GitHub changes | "To get the latest content, say 'download it'" |
| Remote not connected | "Connect to GitHub with 'start Git'" |
When multiple states overlap, guide the most urgent one first according to the priority above, but also explain the overall flow.