- 7.1 Sélection des versions
- 7.2 Indexation interactive
- 7.3 Remisage et nettoyage
- 7.4 Signer votre travail
- 7.5 Recherche
- 7.6 Réécrire l’historique
- 7.7 Reset démystifié
- 7.8 Fusion avancée
- 7.9 Rerere
- 7.10 Déboguer avec Git
- 7.11 Sous-modules
- 7.12 Empaquetage (bundling)
- 7.13 Replace
- 7.14 Stockage des identifiants
- 7.15 Résumé
A3. Git Commands
- A3.1 Installation et configuration
- A3.2 Obtention et création des projets
- A3.3 Capture d’instantané basique
- A3.4 Création de branches et fusion
- A3.5 Partage et mise à jour de projets
- A3.6 Inspection et comparaison
- A3.7 Débogage
- A3.8 Patchs
- A3.9 Courriel
- A3.10 Systèmes externes
- A3.11 Administration
- A3.12 Commandes de plomberie
A3.8 Git Commands - Patching
A few commands in Git are centered around the concept of thinking of commits in terms of the changes they introduce, as thought the commit series is a series of patches. These commands help you manage your branches in this manner.
git cherry-pick command is used to take the change introduced in a single Git commit and try to re-introduce it as a new commit on the branch you’re currently on. This can be useful to only take one or two commits from a branch individually rather than merging in the branch which takes all the changes.
Cherry picking is described and demonstrated in “Gestion par rebasage et sélection de commit”.
git rebase command is basically an automated
cherry-pick. It determines a series of commits and then cherry-picks them one by one in the same order somewhere else.
Rebasing is covered in detail in “Rebaser (Rebasing)”, including covering the collaborative issues involved with rebasing branches that are already public.
We use it in practice during an example of splitting your history into two seperate repositories in “Replace”, using the
--onto flag as well.
We go through running into a merge conflict during rebasing in “Rerere”.
We also use it in an interactive scripting mode with the
-i option in “Modifier plusieurs messages de validation”.
git revert command is essentially a reverse
git cherry-pick. It creates a new commit that applies the exact opposite of the change introduced in the commit you’re targeting, essentially undoing or reverting it.
We use this in “Inverser le commit” to undo a merge commit.