Trabajar en paralelo
La ramificación nos permite trabajar en múltiples espacios de trabajo paralelos.
Para demostrarlo, creemos dos ramas, una con el nombre issue2 y otra con el nombre issue3. A continuación, cambia a issue2.
$ git branch issue2
$ git branch issue3
$ git checkout issue2
Switched to branch 'issue2'
$ git branch
* issue2
issue3
main
En este punto, esta es nuestra historia:
Después, añada el texto en negrita al archivo myfile.txt.
Anyone can learn Git with this tutorial and Backlog
add: Register a change in an index
commit: Save the status of an index
Y después confirme el cambio
$ git add myfile.txt
$ git commit -m "append description of the commit command"
[issue2 8f7aa27] append description of the commit command
1 files changed, 2 insertions(+), 0 deletions(-)
Esta es ahora nuestra historia:
Después cambie a la rama issue3.
$ git checkout issue3
Switched to branch 'issue3'
La rama issue3 tiene actualmente la misma historia y contenido que la rama principal. No incluirá el cambio que acabamos de hacer porque se ha confirmado en la rama issue2.
Añada el texto en negrita al archivo myfile.txt.
Anyone can learn Git with this tutorial and Backlog
add: Register a change in an index
pull: Obtain the content of the remote repository
Y confirme el cambio con el comando añadir.
$ git add myfile.txt
$ git commit -m "append description of the pull command"
[issue3 e5f91ac] append description of the pull command
1 files changed, 2 insertions(+), 0 deletions(-)
Esta es ahora nuestra historia:
Hemos añadido dos líneas de texto diferentes a dos ramas distintas en paralelo.