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

대화형 리베이스 및 커밋 수정

`git rebase -i`로 기록을 다시 작성하여 커밋을 깔끔하게 정리하고, `git commit --amend`로 마지막 커밋을 수정하는 방법을 학습합니다.

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

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

Clean Up Your Git History

Git history gets messy — a forgotten file, a typo'd message, ten tiny commits that should be one. Git lets you rewrite history to clean it up.

Amending Your Last Commit

git commit --amend fixes your most recent commit: change the message, add forgotten files, or tweak content. It replaces the last commit with a tidier one.

Amending a Commit Example

Forgot a file right after committing? Stage it, then git commit --amend folds it into the last commit. Here's the flow.

# 1. Make some changes and commit
echo "Initial content" > file1.txt
git add file1.txt
git commit -m "Add file1"

# 2. Realize you forgot file2.txt
echo "More content" > file2.txt
git add file2.txt

# 3. Amend the last commit to include file2.txt
git commit --amend --no-edit

Introducing Interactive Rebase

Need to fix commits further back, not just the last one? Interactive rebase (git rebase -i) is a full editor for a series of commits.

Getting Started with Rebase -i

Start an interactive rebase by naming a commit before your target range. To edit the last three commits, use HEAD~3.

git rebase -i HEAD~3

Rebase Commands: Pick, Reword, Squash

The rebase editor lists commits with commands you can swap: pick keeps it, reword edits the message, squash/fixup merge it up, edit pauses to amend.

Rewording a Commit Message

To change an older commit's message, switch its line from pick to reword in the editor. Git then prompts you for the new message.

# Original rebase editor content:
# pick 8a9b3c4 Add initial feature
# pick d1e2f34 Fix typo in docs

# Change 'pick' to 'reword' for the first commit:
# reword 8a9b3c4 Add initial feature
# pick d1e2f34 Fix typo in docs

Squashing Commits Together

Got several small commits that belong together? squash merges them into one meaningful commit — change the lines below pick to squash.

# Original commits:
# pick abc1234 Add user registration form
# pick def5678 Add validation for email field
# pick ghi9012 Fix styling on form

# To squash the last two into the first:
# pick abc1234 Add user registration form
# squash def5678 Add validation for email field
# squash ghi9012 Fix styling on form

Editing an Older Commit

The edit command pauses the rebase at a specific commit. Make changes, git add, git commit --amend, then git rebase --continue.

When to Be Careful with Rewriting

Rewriting changes commit IDs — safe for local-only commits. Never rewrite history that's already pushed and shared; it wrecks your collaborators' work.

Quick Check: History Rewriting

You've made a commit with the message "Fix bug". You then realize you forgot to include one small file in that commit. What is the most appropriate Git command to fix this, assuming you haven't pushed the commit yet?

Recap: Cleaner Commits

Recap: git commit --amend fixes the last commit, while git rebase -i rewrites a series — reword, squash, fixup, or edit. Just be careful on shared branches.

자주 묻는 질문

“대화형 리베이스 및 커밋 수정” 강의는 무료인가요?

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

“대화형 리베이스 및 커밋 수정”에서 뭘 배우나요?

`git rebase -i`로 기록을 다시 작성하여 커밋을 깔끔하게 정리하고, `git commit --amend`로 마지막 커밋을 수정하는 방법을 학습합니다. 브라우저에서 직접 실행하는 실습 코드로 Git Advanced: Monorepo, Submodules & Workflows을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

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

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

“대화형 리베이스 및 커밋 수정” 강의는 얼마나 걸리나요?

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

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

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

이 강의의 모든 강의

  1. 대화형 리베이스 및 커밋 수정
  2. 변경 사항 임시 저장 및 체리픽
  3. 복구를 위한 reflog
  4. Bisect: 잘못된 커밋 추적
← Git Advanced: Monorepo, Submodules & Workflows(으)로 돌아가기