Skip to content

imogoapp/git-pr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Git Workflow

Este documento define o fluxo padrão de uso do Git para garantir um histórico limpo, organizado e profissional nos projetos.


Estrutura de Branches

Cada alteração deve ser feita em uma branch separada baseada na main.

Tipos de branch

  • feat/ → nova funcionalidade
  • fix/ → correção de bug
  • chore/ → tarefas internas
  • refactor/ → melhoria de código
  • docs/ → documentação

Exemplos

feat/google-login
fix/register-validation
chore/update-config
refactor/auth-service
docs/api-auth

Fluxo padrão

1. Atualizar a main

git checkout main
git pull origin main

2. Criar nova branch

git checkout -b feat/nome-da-feature

3. Fazer alterações e commit

git add .
git commit -m "feat(scope): descrição da alteração"

4. Enviar branch

git push -u origin feat/nome-da-feature

5. Criar Pull Request

  • Acesse o GitHub
  • Crie a PR
  • Use sempre: Squash and merge

6. Após o merge

git checkout main
git pull origin main
git branch -d feat/nome-da-feature
git push origin --delete feat/nome-da-feature

Regras importantes

❌ NÃO FAÇA ISSO

git commit -m "..."
git checkout -b nova-branch

👉 Isso faz a nova branch herdar commits antigos


✅ FAÇA SEMPRE ASSIM

git checkout main
git pull origin main
git checkout -b nova-branch

🧾 ✍️ Padrão de commits

Formato:

tipo(scope): descrição

Exemplos

feat(auth): adiciona login com Google
fix(auth): corrige validação de email duplicado
feat(ui): ajusta cor da status bar
chore(build): adiciona vercel.json
docs(api): documenta endpoints

Atualizar branch com a main

Se a main foi atualizada:

git checkout sua-branch
git fetch origin
git rebase origin/main
git push --force-with-lease

Limpeza de branches

Após merge:

git branch -d nome-da-branch
git push origin --delete nome-da-branch

🔥 Boas práticas

  • 1 branch = 1 tarefa
  • Sempre usar PR (mesmo sozinho)
  • Preferir commits pequenos e claros
  • Usar Squash and merge
  • Manter a main sempre estável

Fluxo resumido (para decorar)

git checkout main
git pull origin main
git checkout -b feat/minha-feature
git add .
git commit -m "feat(scope): descrição"
git push -u origin feat/minha-feature

About

Boas práticas no github

Resources

Stars

Watchers

Forks

Contributors