This is a sample Git run. It belongs to a post on http://blog.alvarezp.org.
repo-start | repo-clone1 | repo-subclone-1-1 | repo-clone2 | |
---|---|---|---|---|
10 | [alvarezp@octavio:~] $ mkdir git-lab [alvarezp@octavio:~] $ cd git-lab [alvarezp@octavio:~/git-lab] $ mkdir repo-start [alvarezp@octavio:~/git-lab] $ cd repo-start [alvarezp@octavio:~/git-lab/repo-start] $ git init Initialized empty Git repository in ~/git-lab/repo-start/.git/ [alvarezp@octavio:~/git-lab/repo-start] $ cat > plan.txt LABORATORIO DE GIT ================== Tema 1 ------ 1. Introduccion. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. [alvarezp@octavio:~/git-lab/repo-start] $ git add plan.txt [alvarezp@octavio:~/git-lab/repo-start] $ git commit -m 'Envio inicial.' [master (root-commit) 19824dd] Envio inicial. 1 files changed, 11 insertions(+), 0 deletions(-) create mode 100644 plan.txt [alvarezp@octavio:~/git-lab/repo-start] $ cd .. | |||
20 | [alvarezp@octavio:~/git-lab] $ git clone repo-start repo-clone1 Initialized empty Git repository in ~/git-lab/repo-clone1/.git/ | |||
30 | [alvarezp@octavio:~/git-lab] $ git clone repo-start repo-clone2 Initialized empty Git repository in ~/git-lab/repo-clone2/.git/ | |||
40 | [alvarezp@octavio:~/git-lab] $ git clone repo-clone1 repo-subclone-1-1 Initialized empty Git repository in ~/git-lab/repo-subclone-1-1/.git/ | |||
50 | [alvarezp@octavio:~/git-lab] $ cd repo-clone1 [alvarezp@octavio:~/git-lab/repo-clone1] $ cat >> plan.txt Tema 2 ------ 1. Configuracion de Git. 2. Reseteo de HEAD. 3. git rebase. [alvarezp@octavio:~/git-lab/repo-clone1] $ cat plan.txt LABORATORIO DE GIT ================== Tema 1 ------ 1. Introduccion. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. Tema 2 ------ 1. Configuracion de Git. 2. Reseteo de HEAD. 3. git rebase. [alvarezp@octavio:~/git-lab/repo-clone1] $ cd .. | |||
60 | [alvarezp@octavio:~/git-lab] $ cd repo-subclone-1-1/ [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git pull Already up-to-date. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ cat plan.txt LABORATORIO DE GIT ================== Tema 1 ------ 1. Introduccion. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ cd .. | |||
70 | [alvarezp@octavio:~/git-lab] $ cd repo-clone1 [alvarezp@octavio:~/git-lab/repo-clone1] $ git commit -a -m 'Se añadió el tema 2.' Warning: commit message does not conform to UTF-8. You may want to amend it after fixing the message, or set the config variable i18n.commitencoding to the encoding your project uses. [master 473aad7] Se añadió el tema 2. 1 files changed, 7 insertions(+), 0 deletions(-) [alvarezp@octavio:~/git-lab/repo-clone1] $ cd .. | |||
80 | [alvarezp@octavio:~/git-lab] $ cd repo-subclone-1-1/ [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ ls -l total 4 -rw-r--r-- 1 alvarezp alvarezp 212 2009-10-25 00:32 plan.txt [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git pull origin remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From ~/git-lab/repo-clone1 19824dd..473aad7 master -> origin/master Updating 19824dd..473aad7 Fast forward plan.txt | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ cd .. | |||
90 | [alvarezp@octavio:~/git-lab] $ cd repo-clone2 [alvarezp@octavio:~/git-lab/repo-clone2] $ git remote add clone1 ../repo-clone1 [alvarezp@octavio:~/git-lab/repo-clone2] $ git pull clone1 remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From ../repo-clone1 * [new branch] master -> clone1/master You asked to pull from the remote 'clone1', but did not specify a branch to merge. Because this is not the default configured remote for your current branch, you must specify a branch on the command line. [alvarezp@octavio:~/git-lab/repo-clone2] $ git pull clone1 master From ../repo-clone1 * branch master -> FETCH_HEAD Updating 19824dd..473aad7 Fast forward plan.txt | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) [alvarezp@octavio:~/git-lab/repo-clone2] $ cd .. | |||
100 | [alvarezp@octavio:~/git-lab] $ cd repo-clone1 [alvarezp@octavio:~/git-lab/repo-clone1] $ sed -i -re 's/Introduccion/Introduccion a Git/' plan.txt [alvarezp@octavio:~/git-lab/repo-clone1] $ cat plan.txt LABORATORIO DE GIT ================== Tema 1 ------ 1. Introduccion a Git. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. Tema 2 ------ 1. Configuracion de Git. 2. Reseteo de HEAD. 3. git rebase. [alvarezp@octavio:~/git-lab/repo-clone1] $ git diff diff --git a/plan.txt b/plan.txt index 9923d24..952ce4b 100644 --- a/plan.txt +++ b/plan.txt @@ -4,7 +4,7 @@ LABORATORIO DE GIT Tema 1 ------ -1. Introduccion. +1. Introduccion a Git. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. [alvarezp@octavio:~/git-lab/repo-clone1] $ git commit -a -m 'Titulo completo en linea tema 1.1.' [master 9254f7c] Titulo completo en linea tema 1.1. 1 files changed, 1 insertions(+), 1 deletions(-) [alvarezp@octavio:~/git-lab/repo-clone1] $ cd .. | |||
110 | [alvarezp@octavio:~/git-lab] $ cd repo-subclone-1-1 | |||
120 | [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ sed -i -re 's/versiones/versiones (VCS)/' plan.txt [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ cat plan.txt LABORATORIO DE GIT ================== Tema 1 ------ 1. Introduccion. 2. Sistemas de control de versiones (VCS). 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. Tema 2 ------ 1. Configuracion de Git. 2. Reseteo de HEAD. 3. git rebase. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git diff diff --git a/plan.txt b/plan.txt index 9923d24..f75fb05 100644 --- a/plan.txt +++ b/plan.txt @@ -5,7 +5,7 @@ Tema 1 ------ 1. Introduccion. -2. Sistemas de control de versiones. +2. Sistemas de control de versiones (VCS). 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ cd .. | |||
130 | [alvarezp@octavio:~/git-lab] $ cd repo-clone2 [alvarezp@octavio:~/git-lab/repo-clone2] $ sed -i -re 's/Git como ejemplo de un DVCS/Ejemplo de DVCS: Git/' plan.txt [alvarezp@octavio:~/git-lab/repo-clone2] $ git diff diff --git a/plan.txt b/plan.txt index 9923d24..d0635f5 100644 --- a/plan.txt +++ b/plan.txt @@ -7,7 +7,7 @@ Tema 1 1. Introduccion. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. -4. Git como ejemplo de un DVCS. +4. Ejemplo de DVCS: Git. 5. Demostracion practica de Git. Tema 2 [alvarezp@octavio:~/git-lab/repo-clone2] $ git push Counting objects: 5, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 357 bytes, done. Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. warning: updating the current branch warning: Updating the currently checked out branch may cause confusion, warning: as the index and work tree do not reflect changes that are in HEAD. warning: As a result, you may see the changes you just pushed into it warning: reverted when you run 'git diff' over there, and you may want warning: to run 'git reset --hard' before starting to work to recover. warning: warning: You can set 'receive.denyCurrentBranch' configuration variable to warning: 'refuse' in the remote repository to forbid pushing into its warning: current branch. warning: To allow pushing into the current branch, you can set it to 'ignore'; warning: but this is not recommended unless you arranged to update its work warning: tree to match what you pushed in some other way. warning: warning: To squelch this message, you can set it to 'warn'. warning: warning: Note that the default will change in a future version of git warning: to refuse updating the current branch unless you have the warning: configuration variable set to either 'ignore' or 'warn'. To ~/git-lab/repo-start 19824dd..473aad7 master -> master [alvarezp@octavio:~/git-lab/repo-clone2] $ cd .. | |||
140 | [alvarezp@octavio:~/git-lab] $ cd repo-subclone-1-1 [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git push To ~/git-lab/repo-clone1 ! [rejected] master -> master (non-fast forward) error: failed to push some refs to '~/git-lab/repo-clone1' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'non-fast forward' section of 'git push --help' for details. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git pull remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From ~/git-lab/repo-clone1 473aad7..9254f7c master -> origin/master Updating 473aad7..9254f7c error: Entry 'plan.txt' not uptodate. Cannot merge. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git pull Updating 473aad7..9254f7c error: Entry 'plan.txt' not uptodate. Cannot merge. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git commit -a -m 'Siglas VCS para aclaracion.' [master 2b3a8b2] Siglas VCS para aclaracion. 1 files changed, 1 insertions(+), 1 deletions(-) [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git pull Auto-merging plan.txt CONFLICT (content): Merge conflict in plan.txt Automatic merge failed; fix conflicts and then commit the result. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ cat plan.txt LABORATORIO DE GIT ================== Tema 1 ------ <<<<<<< HEAD 1. Introduccion. 2. Sistemas de control de versiones (VCS). ======= 1. Introduccion a Git. 2. Sistemas de control de versiones. >>>>>>> 9254f7cebe3ff258af8f975504c25f04adcd3f61 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. Tema 2 ------ 1. Configuracion de Git. 2. Reseteo de HEAD. 3. git rebase. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ gedit plan.txt [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ cat plan.txt LABORATORIO DE GIT ================== Tema 1 ------ 1. Introduccion a Git. 2. Sistemas de control de versiones (VCS). 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. Tema 2 ------ 1. Configuracion de Git. 2. Reseteo de HEAD. 3. git rebase. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git diff diff --cc plan.txt index f75fb05,952ce4b..0000000 --- a/plan.txt +++ b/plan.txt @@@ -4,8 -4,8 +4,8 @@@ LABORATORIO DE GI Tema 1 ------ - 1. Introduccion. + 1. Introduccion a Git. -2. Sistemas de control de versiones. +2. Sistemas de control de versiones (VCS). 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git commit -a [master f4284be] Merge branch 'master' of ~/git-lab/repo-clone1 [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git show commit f4284be8f94a5996a55fc9fa7c109cbe40333a53 Merge: 2b3a8b2 9254f7c Author: Octavio Alvarez | |||
150 | [alvarezp@octavio:~/git-lab] $ cd repo-clone2 [alvarezp@octavio:~/git-lab/repo-clone2] $ git pull clone1 remote: Counting objects: 11, done. remote: Compressing objects: 100% (6/6), done. remote: Total 9 (delta 4), reused 0 (delta 0) Unpacking objects: 100% (9/9), done. From ../repo-clone1 473aad7..f4284be master -> clone1/master You asked to pull from the remote 'clone1', but did not specify a branch to merge. Because this is not the default configured remote for your current branch, you must specify a branch on the command line. [alvarezp@octavio:~/git-lab/repo-clone2] $ git pull clone1 master From ../repo-clone1 * branch master -> FETCH_HEAD Updating 473aad7..f4284be error: Entry 'plan.txt' not uptodate. Cannot merge. [alvarezp@octavio:~/git-lab/repo-clone2] $ cat plan.txt LABORATORIO DE GIT ================== Tema 1 ------ 1. Introduccion. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. 4. Ejemplo de DVCS: Git. 5. Demostracion practica de Git. Tema 2 ------ 1. Configuracion de Git. 2. Reseteo de HEAD. 3. git rebase. [alvarezp@octavio:~/git-lab/repo-clone2] $ git diff diff --git a/plan.txt b/plan.txt index 9923d24..d0635f5 100644 --- a/plan.txt +++ b/plan.txt @@ -7,7 +7,7 @@ Tema 1 1. Introduccion. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. -4. Git como ejemplo de un DVCS. +4. Ejemplo de DVCS: Git. 5. Demostracion practica de Git. Tema 2 [alvarezp@octavio:~/git-lab/repo-clone2] $ git commit -a -m 'Parafraseo del ejemplo de DVCS.' [master e951ebc] Parafraseo del ejemplo de DVCS. 1 files changed, 1 insertions(+), 1 deletions(-) [alvarezp@octavio:~/git-lab/repo-clone2] $ git pull clone1 master From ../repo-clone1 * branch master -> FETCH_HEAD Auto-merging plan.txt Merge made by recursive. plan.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) [alvarezp@octavio:~/git-lab/repo-clone2] $ cd .. | |||
160 | [alvarezp@octavio:~/git-lab] $ cd repo-start [alvarezp@octavio:~/git-lab/repo-start] $ git remote add clone2 ../repo-clone2 [alvarezp@octavio:~/git-lab/repo-start] $ git pull clone2 remote: Counting objects: 17, done. remote: Compressing objects: 100% (10/10), done. remote: Total 15 (delta 7), reused 0 (delta 0) Unpacking objects: 100% (15/15), done. From ../repo-clone2 * [new branch] master -> clone2/master You asked to pull from the remote 'clone2', but did not specify a branch to merge. Because this is not the default configured remote for your current branch, you must specify a branch on the command line. [alvarezp@octavio:~/git-lab/repo-start] $ git pull clone2 master From ../repo-clone2 * branch master -> FETCH_HEAD Updating 473aad7..72170f2 error: Entry 'plan.txt' would be overwritten by merge. Cannot merge. [alvarezp@octavio:~/git-lab/repo-start] $ cat plan.txt LABORATORIO DE GIT ================== Tema 1 ------ 1. Introduccion. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. [alvarezp@octavio:~/git-lab/repo-start] $ git diff [alvarezp@octavio:~/git-lab/repo-start] $ git diff --cached diff --git a/plan.txt b/plan.txt index 9923d24..d7e8d1e 100644 --- a/plan.txt +++ b/plan.txt @@ -9,10 +9,3 @@ Tema 1 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. - -Tema 2 ------- - -1. Configuracion de Git. -2. Reseteo de HEAD. -3. git rebase. [alvarezp@octavio:~/git-lab/repo-start] $ git reset --hard HEAD HEAD is now at 473aad7 Se añadió el tema 2. [alvarezp@octavio:~/git-lab/repo-start] $ git pull clone2 master From ../repo-clone2 * branch master -> FETCH_HEAD Updating 473aad7..72170f2 Fast forward plan.txt | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) [alvarezp@octavio:~/git-lab/repo-start] $ cd .. | |||
170 | [alvarezp@octavio:~/git-lab] $ cd repo-clone1 [alvarezp@octavio:~/git-lab/repo-clone1] $ git pull clone1 master fatal: 'clone1' does not appear to be a git repository fatal: The remote end hung up unexpectedly [alvarezp@octavio:~/git-lab/repo-clone1] $ git pull remote: Counting objects: 10, done. remote: Compressing objects: 100% (4/4), done. remote: Total 6 (delta 2), reused 0 (delta 0) Unpacking objects: 100% (6/6), done. From ~/git-lab/repo-start 19824dd..72170f2 master -> origin/master Updating f4284be..72170f2 error: Entry 'plan.txt' would be overwritten by merge. Cannot merge. [alvarezp@octavio:~/git-lab/repo-clone1] $ cat plan.txt LABORATORIO DE GIT ================== Tema 1 ------ 1. Introduccion a Git. 2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. Tema 2 ------ 1. Configuracion de Git. 2. Reseteo de HEAD. 3. git rebase. [alvarezp@octavio:~/git-lab/repo-clone1] $ git diff [alvarezp@octavio:~/git-lab/repo-clone1] $ git diff --cached diff --git a/plan.txt b/plan.txt index 7f16f0d..952ce4b 100644 --- a/plan.txt +++ b/plan.txt @@ -5,7 +5,7 @@ Tema 1 ------ 1. Introduccion a Git. -2. Sistemas de control de versiones (VCS). +2. Sistemas de control de versiones. 3. VCS centralizados vs. distribuidos. 4. Git como ejemplo de un DVCS. 5. Demostracion practica de Git. [alvarezp@octavio:~/git-lab/repo-clone1] $ cd .. | |||
180 | [alvarezp@octavio:~/git-lab] $ cd repo-start [alvarezp@octavio:~/git-lab/repo-start] $ git log --pretty=one 721..607 Merge branch 'master' of ../repo-clone1 e95..1bd Parafraseo del ejemplo de DVCS. f42..a53 Merge branch 'master' of ~ 2b3..528 Siglas VCS para aclaracion. 925..f61 Titulo completo en linea tema 1.1. 473..aea Se añadió el tema 2. 198..37c Envio inicial. [alvarezp@octavio:~/git-lab/repo-start] $ cd .. | |||
190 | [alvarezp@octavio:~/git-lab] $ cd repo-clone1 [alvarezp@octavio:~/git-lab/repo-clone1] $ git status # On branch master # Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded. # # Changes to be committed: # (use "git reset HEAD | |||
200 | [alvarezp@octavio:~/git-lab] $ cd repo-subclone-1-1 [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git log --pretty=one f42..a53 Merge branch 'master' of ~ 2b3..528 Siglas VCS para aclaracion. 925..f61 Titulo completo en linea tema 1.1. 473..aea Se añadió el tema 2. 198..37c Envio inicial. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git pull remote: Counting objects: 10, done. remote: Compressing objects: 100% (4/4), done. remote: Total 6 (delta 2), reused 0 (delta 0) Unpacking objects: 100% (6/6), done. From ~/git-lab/repo-clone1 f4284be..72170f2 master -> origin/master Updating f4284be..72170f2 Fast forward plan.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ git log --pretty=one 721..607 Merge branch 'master' of ../repo-clone1 e95..1bd Parafraseo del ejemplo de DVCS. f42..a53 Merge branch 'master' of ~ 2b3..528 Siglas VCS para aclaracion. 925..f61 Titulo completo en linea tema 1.1. 473..aea Se añadió el tema 2. 198..37c Envio inicial. [alvarezp@octavio:~/git-lab/repo-subclone-1-1] $ cd .. | |||
210 | [alvarezp@octavio:~/git-lab] $ cd repo-clone2 [alvarezp@octavio:~/git-lab/repo-clone2] $ git log --pretty=one 721..607 Merge branch 'master' of ../repo-clone1 e95..1bd Parafraseo del ejemplo de DVCS. f42..a53 Merge branch 'master' of ~ 2b3..528 Siglas VCS para aclaracion. 925..f61 Titulo completo en linea tema 1.1. 473..aea Se añadió el tema 2. 198..37c Envio inicial. [alvarezp@octavio:~/git-lab/repo-clone2] $ cd .. | |||
220 | [alvarezp@octavio:~/git-lab] $ cd repo-clone1 [alvarezp@octavio:~/git-lab/repo-clone1] $ git log --pretty=one 721..607 Merge branch 'master' of ../repo-clone1 e95..1bd Parafraseo del ejemplo de DVCS. f42..a53 Merge branch 'master' of ~ 2b3..528 Siglas VCS para aclaracion. 925..f61 Titulo completo en linea tema 1.1. 473..aea Se añadió el tema 2. 198..37c Envio inicial. [alvarezp@octavio:~/git-lab/repo-clone1] $ cd .. | |||
230 | [alvarezp@octavio:~/git-lab] $ cd repo-start [alvarezp@octavio:~/git-lab/repo-start] $ git log --pretty=one 721..607 Merge branch 'master' of ../repo-clone1 e95..1bd Parafraseo del ejemplo de DVCS. f42..a53 Merge branch 'master' of ~ 2b3..528 Siglas VCS para aclaracion. 925..f61 Titulo completo en linea tema 1.1. 473..aea Se añadió el tema 2. 198..37c Envio inicial. [alvarezp@octavio:~/git-lab/repo-start] $ |