Parcourez l’historique, comparez des révisions et attribuez les lignes modifiées.
objectifs d’apprentissage
- Lire l’historique.
- Comparer des commits.
- Identifier l’auteur d’une ligne.
prérequis
- Quelques commits.
- Terminal.
notions clés
- git log —graph.
- git diff.
- git blame.
- SHA.
démonstration guidée
étape 1
Historique condensé et filtré.
git log --oneline --graph --decorate --all
git log --author="Votre Nom" --since="2 weeks"
étape 2
Comparer et blâmer.
git diff HEAD~1..HEAD -- README.md
git blame -L 1,10 README.md
exercice
Retrouvez le commit ayant introduit ‘hello’ dans src/app.py.
correction
Recherche par contenu.
git log -S "hello" -p
quiz éclair
- Quelle option dessine le graphe ?
- a) —graph
- b) —tree
- c) —map