| name | git-workflow |
| description | Git workflow - Boas práticas para branches, commits e PRs |
| version | 1.0.0 |
| category | workflow |
| triggers | ["git","branch","commit","merge","rebase","pull request","pr","versão","release"] |
| tools | [] |
| author | liquid-ai |
| based_on | obra/superpowers |
Git Workflow - Boas Práticas
Esta skill implementa um workflow Git consistente para desenvolvimento em equipe.
Modelo de Branches
main (ou master)
│
├── develop
│ │
│ ├── feature/user-auth
│ ├── feature/payment-flow
│ └── feature/dashboard-v2
│
├── release/v1.2.0
│
└── hotfix/critical-bug
Branch Naming Convention
| Tipo | Pattern | Exemplo |
|---|
| Feature | feature/<descrição> | feature/user-authentication |
| Bugfix | bugfix/<issue-id> | bugfix/issue-123 |
| Hotfix | hotfix/<descrição> | hotfix/security-patch |
| Release | release/<version> | release/v1.2.0 |
| Experiment | experiment/<descrição> | experiment/new-cache |
Regras de Nomenclatura:
- Use kebab-case (palavras separadas por hífen)
- Seja descritivo mas conciso
- Inclua issue ID quando relevante
- Evite caracteres especiais
Commits
Conventional Commits
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Types:
| Type | Quando Usar |
|---|
feat | Nova funcionalidade |
fix | Correção de bug |
docs | Apenas documentação |
style | Formatação (não afeta código) |
refactor | Refatoração (sem feat/fix) |
perf | Melhoria de performance |
test | Adição/correção de testes |
chore | Manutenção (build, deps, etc) |
ci | Mudanças em CI/CD |
Exemplos:
feat(auth): add OAuth2 login with Google
fix(api): handle null response from payment gateway
Closes
feat(api)!: change response format for /users endpoint
BREAKING CHANGE: response now returns array instead of object
Regras de Commit
┌─────────────────────────────────────────────────────────────┐
│ 1. Commits atômicos - Uma mudança lógica por commit │
│ 2. Mensagem clara - Explica O QUE e POR QUÊ │
│ 3. Presente imperativo - "Add feature" não "Added" │
│ 4. Max 72 chars no título │
│ 5. Body para contexto adicional │
└─────────────────────────────────────────────────────────────┘
Commit Atômico - Exemplos:
git commit -m "Add login, fix header, update deps"
git commit -m "feat(auth): add login form"
git commit -m "fix(ui): correct header alignment"
git commit -m "chore(deps): update React to v18"
Workflow Diário
1. Começar Feature
git checkout develop
git pull origin develop
git checkout -b feature/minha-feature
git add .
git commit -m "feat(scope): description"
2. Manter Branch Atualizada
git fetch origin
git rebase origin/develop
git fetch origin
git merge origin/develop
3. Resolver Conflitos
git rebase origin/develop
git rebase --abort
4. Preparar para PR
git rebase -i HEAD~<numero-de-commits>
git push origin feature/minha-feature
git push --force-with-lease origin feature/minha-feature
Pull Requests
Checklist Antes de Abrir PR
Template de PR
## Descrição
[O que este PR faz e por quê]
## Tipo de Mudança
- [ ] Feature nova
- [ ] Bug fix
- [ ] Refatoração
- [ ] Documentação
- [ ] Outro: ___
## Como Testar
1. [Passo 1]
2. [Passo 2]
3. [Resultado esperado]
## Checklist
- [ ] Código segue padrões do projeto
- [ ] Testes adicionados/atualizados
- [ ] Documentação atualizada
- [ ] Sem breaking changes (ou documentado)
## Screenshots (se aplicável)
[Imagens aqui]
## Issues Relacionadas
Closes #123
Tamanho do PR
┌─────────────────────────────────────────────────────────────┐
│ IDEAL: < 400 linhas de código │
│ MÁXIMO: 1000 linhas (divida se maior) │
│ │
│ PRs menores = Reviews melhores = Menos bugs │
└─────────────────────────────────────────────────────────────┘
Comandos Úteis
Desfazer Mudanças
git checkout -- <arquivo>
git restore <arquivo>
git reset --soft HEAD~1
git reset --hard HEAD~1
git revert <commit-hash>
Stash (Guardar Temporariamente)
git stash
git stash save "descrição"
git stash list
git stash pop
git stash apply stash@{2}
Histórico e Busca
git log --oneline --graph --all
git log --grep="palavra"
git blame <arquivo>
git log -S "código" --source --all
Cherry-pick
git cherry-pick <commit-hash>
git cherry-pick -n <commit-hash>
Situações Comuns
"Commitei na Branch Errada"
git reset --soft HEAD~1
git stash
git checkout branch-correta
git stash pop
git commit -m "mensagem"
"Preciso Mudar Mensagem do Último Commit"
git commit --amend -m "nova mensagem"
git rebase -i HEAD~3
"Quero Desfazer Merge"
git reset --hard HEAD~1
git revert -m 1 <merge-commit-hash>
"Branch Divergiu Muito de Develop"
git fetch origin
git rebase origin/develop
git merge origin/develop
Anti-Patterns
| Anti-Pattern | Problema | Solução |
|---|
git add . cego | Commita arquivos indesejados | git add -p ou review antes |
| Force push em shared branch | Perde trabalho dos outros | Use --force-with-lease |
| Commits gigantes | Difícil review e rollback | Commits atômicos |
| Branch de longa vida | Conflitos acumulam | Merge frequente ou feature flags |
| Mensagens vagas | "fix stuff", "wip" | Conventional commits |
Esta skill ativa AUTOMATICAMENTE quando:
- Discussão sobre branches, commits, ou merges
- Usuário menciona "git", "PR", "pull request"
- Problemas com histórico ou conflitos