Commits (saves) the changed files. git add -A + git commitRun it, and afterward explain what was done.
Execution order
Step 1: Parallel status collection
Run the following command in parallel :
git rev-parse --is-inside-work-tree # .git 존재 확인
git symbolic-ref --short HEAD # 현재 branch
git status --porcelain # 변경 파일 목록
git diff --stat # 변경 통계
ls .gitignore 2>/dev/null # .gitignore 존재 여부
Step 2: Safety check
.gitNone: "This is not a Git project folder. Set it up first with 'start Git'." → Abort- Detached HEAD: "You've left a safe location." →
git checkout mainrun and retry - Merge Conflict (
UU,AA, etc.): show the list of conflicted files, and EXECUTE: immediately call the AskUserQuestion tool with the JSON below:
Depending on the choice:{ "questions": [{ "question": "충돌이 있어서 바로 저장할 수 없어요. 두 사람이 같은 부분을 동시에 고쳤거든요.\n충돌 파일: {파일 목록}\n\n어떻게 할까요?", "header": "충돌 해결", "options": [ {"label": "내가 수정한 걸로 유지", "description": "내 변경 내용을 사용해요"}, {"label": "상대방이 수정한 걸로 유지", "description": "상대방의 변경 내용을 사용해요"} ], "multiSelect": false }] }- "Keep what I modified":
git checkout --ours {파일}→git add {파일} - "Keep what the other person modified":
git checkout --theirs {파일}→git add {파일}After resolving the conflict, automatically proceed to the save (commit) step.
- "Keep what I modified":
- No changes: "There are no changes to save. Modify a file and try again." → Abort
Step 3: Auto-generate .gitignore
.gitignoreIf there is none, detect the project type and create a default .gitignoreis created:
- Node.js (
package.jsonpresent) →node_modules/,.env,dist/등 - Python (
requirements.txtorpyproject.tomlpresent) →__pycache__/,.env,venv/등 - General →
.env,.DS_Store,*.log,thumbs.db등
After creation, notify: "For security, a .gitignore file has been created. Passwords and temporary files are automatically excluded."
Step 4: Show changed files + request commit message
Show the list of changed files, then ask for the commit message.
EXECUTE: Immediately call the AskUserQuestion tool with the JSON below (include the changed file list in the question):
{
"questions": [{
"question": "변경된 파일 N개:\n - file1 (수정됨)\n - file2 (새 파일)\n\n뭘 바꿨는지 한 줄로 적어주세요.",
"header": "커밋 메시지",
"options": [
{"label": "직접 입력", "description": "Other에 커밋 메시지를 입력해주세요 (예: '로고 변경', '메인 페이지 수정')"},
{"label": "자동 생성", "description": "변경 내용을 분석해서 메시지를 자동으로 만들어요"}
],
"multiSelect": false
}]
}
The file list in the question is dynamically generated based on the
git status --porcelainresults.
If the user gives an empty or ambiguous answer: Analyze the changes and automatically generate a natural-language message.
Step 5: Execute save
git add -A
git commit -m "사용자가 입력한 메시지"
Commit message rules:
- Use the user's natural language as-is (do not enforce conventional commits)
- Both Korean/English allowed
- E.g.: "logo change", "main page edit", "typo fix"
Step 6: Print receipt
After execution, report the result:
저장 완료! 파일 3개를 포장해서 '로고 변경'이라고 기록했어요.
아직 내 컴퓨터에만 있어요.
GitHub 클라우드에도 올리려면 "올려줘"라고 하세요.
Key emphasis points
- After saving, every time remind "It's still only on my computer"
- Let them feel the difference between Commit and Push
- Guide the next action (Push)