Crear un conflicto
Cuando surja un conflicto, tendrá que resolverlo para completar su trabajo. En este paso, vamos a crear deliberadamente un conflicto utilizando nuestros dos repositorios existentes, “tutorial” y “tutorial2”.
En primer lugar, abra el archivo sample.txt
del directorio tutorial
en su equipo. Añada el texto en negrita al archivo y confírmelo.
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/b683470b31a40f86391522436697d1b3/5a190/01.png)
Después, abra el archivo sample.txt
del directorio tutorial2
. Añada el texto en negrita al archivo y confírmelo.
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/7634cb44e65f530824997885febac9df/5a190/02.png)
Ahora suba el cambio de tutorial2
al repositorio remoto.
![push the change from tutorial2 to the remote repository](/static/96503b68a6f01c7714013b58f2086bbf/5a190/03.png)
En nuestro repositorio remoto actual, el archivo sample.txt
contiene la tercera línea pull: Obtain the content of the remote repository
y se ha consignado en el registro del historial.
A continuación, enviaremos el commit de nuestro repositorio tutorial
al repositorio remoto.
![Git raises a conflict and rejects your push](/static/1e6b63890ffd7b427601832462f7a7c1/5a190/04.png)
Como puede ver, Git plantea un conflicto y rechaza su push.