repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

opencode/skills/git-branch/SKILL.md

Raw

name: git-branch description: Create and manage git branches — feature/fix/hotfix naming, trunk-based vs feature-branch workflows, stale branch cleanup. license: MIT

What I do

Create and manage branches following consistent workflow.

Naming

<type>/<ticket-id>-<short-description>

Examples:

feat/123-add-user-auth
fix/456-login-redirect
hotfix/789-memory-leak

Workflow

Create

git fetch origin
git checkout main
git pull origin main
git checkout -b feat/123-add-user-auth

Work

# Make commits
git add file.rs
git commit -m "feat: add login"

# Update with main
git fetch origin
git rebase origin/main

Push

git push -u origin feat/123-add-user-auth

Cleanup

git push origin --delete feat/123-add-user-auth
git branch -d feat/123-add-user-auth

Commands

# List branches
git branch -v

# Switch branch
git checkout fix/456

# Track remote
git checkout --track origin/fix/456

Best Practices


Use for clear, maintainable branches.

Markdown source
File outline
---
name: git-branch
description: Create and manage git branches — feature/fix/hotfix naming, trunk-based vs feature-branch workflows, stale branch cleanup.
license: MIT
---

## What I do

Create and manage branches following consistent workflow.

## Naming

```
<type>/<ticket-id>-<short-description>
```

- feat: New features
- fix: Bug fixes
- docs: Documentation
- refactor: Refactoring
- test: Tests
- chore: Maintenance
- hotfix: Urgent fixes
- release: Release prep

Examples:

```
feat/123-add-user-auth
fix/456-login-redirect
hotfix/789-memory-leak
```

## Workflow

### Create

```bash
git fetch origin
git checkout main
git pull origin main
git checkout -b feat/123-add-user-auth
```

### Work

```bash
# Make commits
git add file.rs
git commit -m "feat: add login"

# Update with main
git fetch origin
git rebase origin/main
```

### Push

```bash
git push -u origin feat/123-add-user-auth
```

### Cleanup

```bash
git push origin --delete feat/123-add-user-auth
git branch -d feat/123-add-user-auth
```

## Commands

```bash
# List branches
git branch -v

# Switch branch
git checkout fix/456

# Track remote
git checkout --track origin/fix/456
```

## Best Practices

- [ ] Branch from up-to-date main
- [ ] Descriptive names with ticket#
- [ ] One feature per branch
- [ ] Rebase main regularly
- [ ] Delete after merge

---

Use for clear, maintainable branches.