← Trail· Lesson 6 of 9
Branches and checkout
Create branches, switch with switch/checkout, and isolate a feature.
TODO i18n: Full body translation pending. Title and description are localized; the body below remains in Portuguese for now.
Uma branch é um ponteiro para um commit. Trabalhar em branch evita bagunçar a main enquanto você experimenta.
Ver branches
git branch
O asterisco marca a branch atual.
Criar e entrar numa branch
git switch -c feature/titulo-pagina
# equivalente clássico:
# git checkout -b feature/titulo-pagina
Voltar para main
git switch main
Isolar uma mudança
Na branch feature/…:
# edite index.html, por exemplo
git add index.html
git commit -m "feat: atualiza título da página"
git switch main
Em main, o arquivo não tem essa mudança — ela vive só na feature até o merge.
Remover branch local (depois do merge)
git branch -d feature/titulo-pagina
Checklist
- Criou uma branch com
git switch -c - Fez um commit nela
- Voltou para
maine confirmou que a mudança não está lá