Créer un conflit
Lorsqu'un conflit survient, vous devez le résoudre pour terminer votre travail. Dans cette étape, nous allons délibérément créer un conflit à partir de nos deux référentiels existants, « tutorial » et « tutorial2 ».
Ouvrez tout d'abord le fichier sample.txt
dans le répertoire tutorial
. Ajoutez le texte en gras ci-dessous au fichier et validez.
Anyone can learn Git with this tutorial and Backlog
add: Register a change in an index
commit: Save the status of an index
![Record the status of commit index](/static/4e9a8f49ec25d1845324f70ea1eab76b/5a190/01.png)
Ouvrez ensuite le fichier sample.txt
dans le répertoire tutorial2
. Ajoutez le texte en gras ci-dessous au fichier et validez.
Anyone can learn Git with this tutorial and Backlog
add: Register a change in an index
pull: Obtain the content of the remote repository
![pull Acquire the contents of a remote repository.](/static/872e42c66e37b3235eba483a2d018be7/5a190/02.png)
Transférez à présent la modification apportée dans tutorial2
vers le référentiel distant.
![Push to the remote repository](/static/16e668f363254db234adcd68f556befa/5a190/03.png)
Dans notre référentiel distant actif, le fichier sample.txt
contient la troisième ligne pull: Obtain the content of the remote repository
et il a été validé dans le journal historique.
Nous allons ensuite transférer le commit de notre référentiel tutorial
vers le référentiel distant.
![Git raises a conflict and rejects your push](/static/aad1db1136d67488d3905f317fd9b91f/5a190/04.png)
Comme vous pouvez le constater, Git génère un conflit et rejette votre transfert.