정리와 실습
핵심 요약
- 은 프로젝트의 저장 지점입니다 — 언제든 되돌아갈 수 있는 완전한 타임라인이고, 덕분에 두려움 없이 AI를 풀어놓을 수 있습니다.
- 핵심 리듬은
add→commit→push입니다: 변경 사항을 stage하고, 명확한 메시지를 단 으로 저장하고, 백업과 공유를 위해 GitHub에 올립니다. - 큰 작업 전에는 브랜치를 만들고, 커밋할 때마다 diff를 읽으세요 — AI가 지우면 안 될 것을 지우는 걸 잡아내는 방법입니다.
.gitignore는 비밀(.env같은 것)과 쓰레기(node_modules/같은 것)를 히스토리에서 빼냅니다. GitHub에 커밋된 비밀은 나중에 지워도 영원히 유출된 것입니다.- AI에게 명령을 실행시켜도 되지만, 각 명령이 무엇을 했는지 이해할 책임은 여러분에게 있습니다 — 특히
reset --hard같은 파괴적인 명령은요.
직접 해보기
완전히 새 폴더를 만들고 전체 흐름을 손으로 직접 돌려보세요: git init, .env가 들어간 .gitignore 만들기, 간단한 notes.txt 파일 추가, 그다음 git add .와 git commit -m "Initial commit". 이제 git log --oneline을 실행해 저장 지점을 보고, 파일을 편집한 뒤 git diff를 실행해 Git이 무엇이 바뀌었는지 정확히 보여주는 걸 지켜보세요. 아무것도 잘못될 수 없는 프로젝트에서 이 장의 모든 핵심 습관을 방금 다 써본 것입니다.
이 장의 프롬프트
I'm learning Git as a beginner and I want you to run the commands for me,
but teach as you go. For the task below:
<describe what you want to do — e.g. "save my current work" or "try a risky change safely">
- Tell me which Git commands you'll run and what each one does in plain English.
- If anything is destructive (reset --hard, force-push, deleting a branch),
warn me clearly and explain what I'd lose before doing it.
- Before any commit, show me the diff and summarize what changed.
- Remind me if there's anything in the change that shouldn't be public (secrets, keys).