λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
πŸ‘¨‍πŸ’» web.dev/ops

Claude Code μ»€μŠ€ν…€ μ»€λ§¨λ“œλ‘œ Git μ›Œν¬ν”Œλ‘œμš° μžλ™ν™”ν•˜κΈ°

by HandHand 2025. 12. 15.

 

 

개발 κ³Όμ •μ—μ„œ μž‘μ—…μ˜ λ§₯락을 꼼꼼히 담은 컀밋 λ©”μ‹œμ§€μ™€ Pull Request(PR)λ₯Ό λ‚¨κΈ°λŠ” 것이, ν›—λ‚  μœ μ§€λ³΄μˆ˜λ₯Ό μœ„ν•΄ μ–Όλ§ˆλ‚˜ μ€‘μš”ν•œμ§€λŠ” 우리 λͺ¨λ‘ 잘 μ•Œκ³  μžˆμŠ΅λ‹ˆλ‹€.

ν•˜μ§€λ§Œ 막상 κ°œλ°œμ— λͺ°μž…ν•˜λ‹€ 보면 λ³€κ²½ 사항은 κ±·μž‘μ„ 수 없이 μŒ“μ΄κΈ° 마련이고, λ’€λŠ¦κ²Œ 이λ₯Ό 논리적인 λ‹¨μœ„λ‘œ μͺΌκ°œμ–΄ μ»€λ°‹ν•˜λŠ” 일은 μ—¬κ°„ 번거둜운 게 μ•„λ‹™λ‹ˆλ‹€. μ •μ„±μŠ€λŸ½κ²Œ PR을 μž‘μ„±ν•˜λŠ” 것 λ˜ν•œ μƒλ‹Ήν•œ μ—λ„ˆμ§€κ°€ λ“œλŠ” 일이죠.

κ·Έλž˜μ„œ μ €λŠ” 이 반볡적이고 μ†Œλͺ¨μ μΈ 과정을 LLM을 ν™œμš©ν•΄ μžλ™ν™”ν•΄λ³΄λ € ν•©λ‹ˆλ‹€.

 

πŸ“Œ custom slash command

claude code μ—λŠ” custom slash command λΌλŠ” κΈ°λŠ₯이 μžˆμŠ΅λ‹ˆλ‹€.

https://code.claude.com/docs/en/slash-commands#custom-slash-commands

 

Slash commands - Claude Code Docs

Control Claude's behavior during an interactive session with slash commands.

code.claude.com

 

 

.claude/commands 디렉토리 μ•„λž˜μ— μš°λ¦¬κ°€ μ‚¬μš©ν•  λͺ…λ Ήμ–΄λ“€μ˜ 섀정을 μ •μ˜ν•΄μ£ΌκΈ°λ§Œ ν•˜λ©΄ λ©λ‹ˆλ‹€.

이번 ν¬μŠ€νŠΈμ—μ„œλŠ” μž‘μ—… λ‚΄μš©μ„ 뢄석해 μ μ ˆν•œ 컀밋 λ©”μ‹œμ§€λ₯Ό μƒμ„±ν•˜λŠ” /commit λͺ…령어와, ν˜„μž¬ 브랜치의 λ³€κ²½ 사항을 μ’…ν•©ν•΄ Pull Request μ΄ˆμ•ˆμ„ μž‘μ„±ν•΄μ£ΌλŠ” /pull-request λͺ…λ Ήμ–΄λ₯Ό μΆ”κ°€ν•΄λ³΄κ² μŠ΅λ‹ˆλ‹€.

 

πŸ“Œ git commit λͺ…λ Ήμ–΄

 

commit 의 ν˜•μ‹κ³Ό μœ μ˜μ‚¬ν•­λ“±μ„ μž‘μ—… μ§€μΉ¨μœΌλ‘œ μ „λ‹¬ν•©λ‹ˆλ‹€.

---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
description: Create a git commit
---

## Context

- Current git status: !`git status`
- Current git diff (staged and unstaged changes): !`git diff HEAD`
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline --decorate`

## Your task

Analyze the changes in the working directory and create appropriate git commits.

**Important:**

1. Review all changed files (both staged and unstaged)
2. Group related changes together logically
3. If there are multiple unrelated changes, create separate commits for each logical group
4. Use only staged changes for commit
5. Avoid mixing unrelated changes in the same commit
6. Commit short summary and body must be in Korean (scope must be in English because it would be package name or directory name)
7. Do not co-author commits (Claude)

**Steps:**

- First, analyze the git status and diff to understand all changes
- Identify logical groups of related changes
- For each group:
  - Create a commit with an appropriate message
- If changes are simple and related, a single commit is fine

Once you have staged the necessary changes for a commit group, create the commit.
Use the following format for the commit message:

```
(<scope>): <emoji type> <short summary>
<BLANK LINE>
<body (optional)>
<BLANK LINE>
```

emoji type can be one of the following:

- ✨ : add/fix feature
- ✏️ : comments or typo fix
- ♻️ : refactor
- 🎨 : add/change UI layout or CSS
- 🍱 : add/change static files
- πŸ’¬ : apply code review
- πŸ“ : documentation
- πŸš€ : release commit
- πŸ“¦ : npm package update (package.json)
- ⚑️ : improve performance
- πŸ› : fix bug
- πŸ’… : fix lint, prettier error
- πŸ”₯ : hot fix
- 🧹 : remove unnecessary code or files
- πŸ‘· : add/change ci/cd workflow
- βš™οΈ : add/change project config file (eslintrc, prettierrc etc.)
- πŸ¦‹ : commit changeset file
- 🚧 : work in progress, but commit for split large scale jobs
- πŸ” : fix rebase conflict issue



πŸ‘€ μ‚¬μš© μ˜ˆμ‹œ

 

 

πŸ“Œ pull request λͺ…λ Ήμ–΄

 

λ™μΌν•œ λ°©μ‹μœΌλ‘œ pull request λ₯Ό μƒμ„±ν•˜λŠ” λͺ…령어도 μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

pull request λ₯Ό μƒμ„±ν•˜λ €λ©΄ GitHub 에 접근이 κ°€λŠ₯ν•΄μ•Όν•˜λŠ”λ°, GitHub MCP λ₯Ό μ‚¬μš©ν•˜μ§€ μ•Šκ³  gh CLI 둜 λ‹¨μˆœν•˜κ²Œ μ²˜λ¦¬ν•˜λŠ” 방식을 μ‚¬μš©ν•˜κ² μŠ΅λ‹ˆλ‹€.

μ‚¬μš©ν•˜λ €λ©΄ 졜초 인증 과정이 ν•„μš”ν•©λ‹ˆλ‹€.

 

https://cli.github.com/manual/gh_pr_create

 

GitHub CLI

Take GitHub to the command line

cli.github.com

 

생성할 pull request template md νŒŒμΌμ„ 생성해놓고, pull request description μž‘μ„± μ‹œμ— 이λ₯Ό μ°Έκ³ ν•˜λ„λ‘ μ§€μ‹œν•©λ‹ˆλ‹€.

 

---
allowed-tools: Bash(git *), Bash(gh *), Bash(brew install gh)
description: Create a pull request
---

## Context

- Current git status: !`git status`
- Current branch: !`git branch --show-current`
- Recent commits on current branch: !`git log main..HEAD --oneline`
- Recent commit diffs on current branch: !`git log main..HEAD -p`

## Your task

Create a pull request for the current branch against the main branch on GitHub.

**Important:**

1. Ensure all changes are committed before creating the pull request
2. Use a clear and descriptive title for the pull request
3. Write a detailed description of the changes made in the pull request
4. Use Korean for the title and description. But `<scope>` in the title must be in English because it would be package name or directory name

**Steps:**

- First, ensure all prerequisites are met:
  - If there are uncommitted changes, reject this task and ask user to commit first
  - If the branch doesn't have an upstream configured, push the branch to the remote repository first
- Second, check all of the current branch commit ids ahead to target branch.
- Third, gather information about the changes made in the current branch
- Then, use the GitHub CLI to create a pull request with an appropriate title and description
  - Use `gh` commands to create the pull request
  - If `gh` is not installed, install it using `brew install gh`
  - Use the `Pull Request Template Format` section below for the pull request title and description
  - Create the pull request against the `main` branch
    - Use `gh pr create --base main --title "<title>" --body "<description>"`
- Finally, provide the URL of the created pull request

**Pull Request Template Format:**

- Title: `(<scope>): <short summary>`
- Body: Use the format from `.github/PULL_REQUEST_TEMPLATE.md` file in the repository. Fill in the description section with a summary of changes, issues fixed, motivation, context, and any dependencies.

 

 

πŸ‘€ μ‚¬μš© μ˜ˆμ‹œ

λ°˜μ‘ν˜•

πŸ’¬ λŒ“κΈ€