Gerenciando Repositórios Grandes
Estratégias
Abordagens
Configurações
# Configurar LFS
git lfs install
git lfs track "*.psd"
# Clone parcial
git clone --filter=blob:none URL
# Sparse checkout
git sparse-checkout set dir1 dir2
Otimização
Técnicas
+------------------------+
| OTIMIZAÇÕES |
| |
| • Git LFS |
| • Partial clone |
| • Shallow clone |
| • Sparse checkout |
| • Bfg-repo-cleaner |
+------------------------+
Limpeza
# Remover arquivos grandes
git filter-branch --tree-filter \
'rm -rf path/to/large/file' HEAD
# Limpar histórico
git gc --aggressive --prune=now
Monitoramento
Métricas Importantes
Ferramentas
# Análise de tamanho
git count-objects -vH
# Objetos grandes
git verify-pack -v .git/objects/pack/*.idx | \
sort -k 3 -n | tail -10
# Status LFS
git lfs status
Boas Práticas
Recomendações
Use Git LFS para binários
Implemente partial clone
Mantenha histórico limpo
Monitore crescimento
Documente políticas
Manutenção Regular
# Limpeza periódica
git maintenance start
# Verificação
git fsck --full
# Compactação
git repack -ad
Próximos Passos
Tópicos Relacionados
22 abril 2025