Git Pie: A Arte Ancestral do Versionamento 🥧 Help

Git Bisect: Encontrando Bugs com Busca Binária

+------------------------+ | Git Bisect | | | | Bug Hunting | | Binary Search | | Automated Testing | | | | Efficient Debugging | +------------------------+

Conceitos Básicos

Como Funciona

Início

Início

Testar

Bom

Ruim

Commit Bom

Busca Binária

Commit Ruim

Commit Médio

Metade Superior

Metade Inferior

Processo de Debug

CommitsBisectDeveloperCommitsBisectDeveloperStart bisectCheck commitTest resultMark good/bad

Comandos Essenciais

Operações Básicas

# Iniciar bisect git bisect start git bisect bad HEAD git bisect good v1.0.0 # Marcar commits git bisect good git bisect bad # Finalizar git bisect reset

Automação

# Criar script de teste echo '#!/bin/sh make test' > test.sh chmod +x test.sh # Executar bisect automático git bisect start git bisect bad HEAD git bisect good v1.0.0 git bisect run ./test.sh

Casos de Uso

Cenários Comuns

BisectPerformanceBugsTestesRegressõesGargalosFuncionaisVisuaisFalhasInstabilidades

Workflow Típico

+------------------------+ | WORKFLOW | | | | 1. Identificar bug | | 2. Definir limites | | 3. Iniciar bisect | | 4. Testar commits | | 5. Encontrar causa | +------------------------+

Boas Práticas

Recomendações

PráticasPreparaçãoExecuçãoAnáliseScripts prontosAmbiente limpoTestes rápidosLogs clarosDocumentarVerificar fix

Automação

# Script de teste completo cat << 'EOF' > test.sh #!/bin/sh make build if ! make test; then exit 1 fi if ! ./performance_test.sh; then exit 1 fi exit 0 EOF

Troubleshooting

Problemas Comuns

ProblemasAmbienteTestesEstadoBuild quebradoDeps faltandoFalsos positivosTimeoutWorking treeStash

Soluções

# Salvar trabalho atual git stash # Limpar ambiente git clean -fdx # Restaurar estado git bisect reset git stash pop

Workflows Avançados

CI Integration

#!/bin/sh # Script para CI git bisect start HEAD v1.0.0 git bisect run docker-compose run tests

Visualização

Bisect

Bad

Good

Found

Start

Commit 1

Commit 2

Commit 3

Bug Commit

Dicas Avançadas

Performance

# Skip builds desnecessários git bisect skip HEAD git bisect skip v2.1.0..v2.2.0 # Log detalhado git bisect log > bisect_log.txt

Debug Avançado

+------------------------+ | DEBUG AVANÇADO | | | | • Logs detalhados | | • Skip commits | | • Visualização | | • Replay bisect | | • Terms custom | +------------------------+

Integração com Ferramentas

IDE Support

IDEVSCodeJetBrainsEclipseGit LensTimelineGit ToolboxVCS LogEGitHistory

Próximos Passos

Tópicos Relacionados

22 abril 2025