← Trail· Lesson 5 of 9
Commits
Clear messages, git log, diff, and the habit of small commits.
TODO i18n: Full body translation pending. Title and description are localized; the body below remains in Portuguese for now.
Um commit congela o staging num ponto do histórico, com mensagem e autor.
Criar o commit
git commit -m "docs: adiciona README inicial"
Mensagens curtas no imperativo (“adiciona”, “corrige”, “remove”) funcionam bem.
Ver o histórico
git log --oneline
git log
Ver o que mudou
git diff # working tree vs staging
git diff --staged # staging vs último commit
Fluxo do dia a dia
- Editar arquivos
git status— o que mudou?git add …— escolher o que entragit commit -m "…"— registrar- Repetir
O que evitar por enquanto
git commit --amendem commits já enviados ao remoto- Reescrever histórico compartilhado
Na dúvida: faça um novo commit corretivo.
Checklist
- Pelo menos 2 commits no repo de teste
-
git log --onelinemostra as mensagens - Você usou
git diffantes de umadd