Agent skill
git-workflow-skill-plannededge-codebook
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/git-workflow-skill-plannededge-codebook
SKILL.md
Git Workflow Skill
[!FIXED!]
Purpose
This skill provides procedures for Git operations in the development workflow. It covers branching, commits, and pull requests.
When to use:
- Creating branches for new work
- Making commits
- Creating pull requests
- Merging changes [!FIXED!]
=== PREREQUISITES ===
Before using this skill:
- Git is installed
- Repository is cloned locally
- Commit message standard exists (@ref(CB-STD-COMMITS-001))
- You have push access (or will create PR)
=== PROCEDURE: CREATE BRANCH ===
Branch Naming Convention
<type>/<description>
Types:
- feature/ : New features
- bugfix/ : Bug fixes
- hotfix/ : Urgent production fixes
- refactor/ : Code refactoring
- docs/ : Documentation only
- test/ : Test additions
- chore/ : Maintenance tasks
Steps
-
Ensure you're on main/develop
bashgit checkout main git pull origin main -
Create and checkout new branch
bashgit checkout -b feature/add-user-authentication -
Log in buildlog
markdown| HH:MM | #micro-decision | Created branch feature/add-user-authentication | - |
Branch Naming Examples
| Good | Bad |
|---|---|
feature/add-oauth-login |
new-login |
bugfix/fix-null-pointer-123 |
fix |
docs/update-api-docs |
documentation |
=== PROCEDURE: MAKE COMMITS ===
Commit Message Format
<type>(<scope>): <description>
[optional body]
[optional footer]
Types
| Type | Purpose |
|---|---|
| feat | New feature |
| fix | Bug fix |
| docs | Documentation |
| style | Formatting (no code change) |
| refactor | Code restructuring |
| test | Adding tests |
| chore | Maintenance |
| perf | Performance improvement |
Steps
-
Stage changes
bashgit add <files> # or for all changes: git add . -
Review staged changes
bashgit status git diff --staged -
Commit with message
bashgit commit -m "feat(auth): add OAuth2 login support" -
Log in buildlog
markdown| HH:MM | #commit | feat(auth): add OAuth2 login support | PR #XX |
Commit Message Examples
| Good | Bad |
|---|---|
feat(auth): add OAuth2 login support |
added login |
fix(api): handle null response from endpoint |
fix bug |
docs(readme): add installation instructions |
update docs |
refactor(utils): extract date formatting logic |
refactoring |
Commit Frequency
- Commit logical chunks of work
- Each commit should be independently functional
- Don't bundle unrelated changes
- Can be squashed later if needed
=== PROCEDURE: CREATE PULL REQUEST ===
Before Creating PR
-
Ensure all commits are pushed
bashgit push origin <branch-name> -
Run pre-merge checks
- All tests pass
- Linter passes
- Code reviewed by self
- Documentation updated if needed
PR Title Format
<type>(<scope>): <description>
Same format as commit messages.
PR Description Template
## Summary
Brief description of what this PR does.
## Changes
- List of significant changes
- Bullet points preferred
## Testing
- How was this tested?
- Test coverage info
## Related Issues
Closes #123
Related to #456
## Checklist
- [ ] Tests pass
- [ ] Documentation updated
- [ ] No breaking changes (or documented)
Steps
-
Push branch
bashgit push -u origin feature/add-user-authentication -
Create PR via GitHub/GitLab/etc.
- Use PR title format
- Fill in description template
- Add reviewers
- Add labels
-
Log in buildlog
markdown| HH:MM | #micro-decision | Created PR #42 for feature/add-user-authentication | PR #42 |
=== PROCEDURE: MERGE CHANGES ===
Merge Strategies
| Strategy | When to Use |
|---|---|
| Squash and Merge | Feature branches, clean history |
| Rebase and Merge | Linear history preferred |
| Merge Commit | Preserve branch history |
Steps
-
Ensure PR is approved
- Required reviews complete
- CI checks pass
- No merge conflicts
-
Merge using preferred strategy
- Via GitHub UI, or:
bashgit checkout main git merge --squash feature/add-user-authentication git commit -m "feat(auth): add OAuth2 login support (#42)" git push origin main -
Delete branch
bashgit branch -d feature/add-user-authentication git push origin --delete feature/add-user-authentication -
Log in buildlog
markdown| HH:MM | #commit | Merged feat(auth): add OAuth2 login support | PR #42 |
=== PROCEDURE: HANDLE CONFLICTS ===
Steps
-
Update main and rebase
bashgit checkout main git pull origin main git checkout feature/your-branch git rebase main -
Resolve conflicts
- Open conflicting files
- Resolve conflict markers
- Test resolution
bashgit add <resolved-files> git rebase --continue -
Force push (if rebased)
bashgit push --force-with-lease origin feature/your-branch -
Log in buildlog
markdown| HH:MM | #resolution | Resolved merge conflicts in <files> | PR #42 |
Conflict Prevention
- Rebase frequently against main
- Communicate about files being modified
- Break large changes into smaller PRs
=== PROCEDURE: REVERT CHANGES ===
Revert a Commit
# Revert last commit (creates new commit)
git revert HEAD
# Revert specific commit
git revert <commit-hash>
# Revert without auto-commit
git revert -n <commit-hash>
Log in Buildlog
| HH:MM | #resolution | Reverted commit <hash> due to <reason> | - |
=== ANTI-PATTERNS ===
| Anti-Pattern | Why Bad | Alternative |
|---|---|---|
| Force push to main | Destroys history | Never force push shared branches |
| Giant commits | Hard to review/revert | Break into logical chunks |
| Vague commit messages | No context | Use conventional format |
| Committing secrets | Security risk | Use .gitignore, env vars |
| Long-lived branches | Merge conflicts | Merge frequently |
=== RELATED DOCUMENTS ===
| Document | Codebook ID | Relationship |
|---|---|---|
| commit-messages.md | CB-STD-COMMITS-001 | Message format |
| pr.template.md | CB-TPL-PR-001 | PR description |
| git-flow.md | CB-WF-GITFLOW-001 | Full workflow |
Didn't find tool you were looking for?