Ramas remotas#
Última modificación: Mayo 14, 2022
Preparación del proyecto#
[1]:
!rm -rf git-demo
!mkdir git-demo
%cd git-demo
/workspace/git-demo
[2]:
!mkdir user-one
[3]:
%cd user-one
/workspace/git-demo/user-one
[4]:
!git init
Initialized empty Git repository in /workspace/git-demo/user-one/.git/
[6]:
!git branch -v
[7]:
!git remote add origin https://github.com/jdvelasq/git-demo-remote-1
[14]:
!git fetch origin
[8]:
!git pull origin main
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), 1.20 KiB | 32.00 KiB/s, done.
From https://github.com/jdvelasq/git-demo-remote-1
* branch main -> FETCH_HEAD
* [new branch] main -> origin/main
[9]:
!git config user.email "user_one@example.com"
!git config user.name "User One"
[10]:
!git branch
* master
[11]:
!git branch --move master main
[12]:
!git branch
* main
[13]:
!echo 'Hola mundo cruel!' > file_1.txt
!git add file_1.txt
!git commit -m 'modify file_1.txt file by user-one'
[main e185db8] modify file_1.txt file by user-one
1 file changed, 1 insertion(+), 1 deletion(-)
[ ]:
[ ]:
[ ]:
[ ]:
[ ]:
[ ]:
[ ]:
!git init
Simulación del desarrollador 1#
[ ]:
!git clone https://github.com/jdvelasq/git-demo-remote-1
[ ]:
!mv git-demo-remote-1 user-1
Simulación del desarrollador 2#
[ ]:
!git clone https://github.com/jdvelasq/git-demo-remote-1
[ ]:
!mv git-demo-remote-1 user-2
Cambios locales del desarrollador 1#
[ ]:
%cd user-1
[ ]:
!git config user.email "user_one@example.com"
!git config user.name "User One"
[ ]:
!git remote -v
Sincronización de cambios del desarrollador 1#
[ ]:
# en el terminal
# !git push
Cambios locales del desarrollador 2#
[ ]:
%cd user-2
[ ]:
!git config user.email "user_two@example.com"
!git config user.name "User Two"
[ ]:
!echo 'Hello World!!!!' > file_2.txt
!git add file_2.txt
!git commit -m 'modify file_2.txt file by user-2'
[ ]:
!git push origin
Sincronización de cambios del desarrollador 2#
[ ]:
!git fetch origin
[ ]:
[ ]:
[ ]:
%cd ../..
[ ]:
!pwd
[ ]:
# --< Limpieza del área de trabajo >-------------------------------------------
%cd ..
!rm -rf git-demo
[ ]: