Control de Versión con GIT
Contents
EL trabajo en desarrollo de producto en Liferay me va a llevar a utilizar de forma intensiva GIT. El código fuente de Liferay está en subverison así que git es perfecto al interoperar con él.
Init
acs@reborn:tmp$ mkdir git1 acs@reborn:tmp$ cd git1/ acs@reborn:git1$ git init Initialized empty Git repository in .git/
Commit
acs@reborn:git1$ git branch acs@reborn:git1$ echo Test > README acs@reborn:git1$ git add README acs@reborn:git1$ git commit -a Created initial commit 89235a5: Primer commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 README acs@reborn:git1$ git branch * master
Branches
acs@reborn:git1$ git branch test1 acs@reborn:git1$ git branch * master test1 acs@reborn:git1$ git checkout test1 Switched to branch "test1" acs@reborn:git1$ ls README acs@reborn:git1$ echo test1 >Branch acs@reborn:git1$ git add Branch acs@reborn:git1$ git commit Branch Created commit 17d9982: Only in the branch 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 Branch acs@reborn:git1$ ls Branch README acs@reborn:git1$ git checkout master Switched to branch "master" acs@reborn:git1$ ls README acs@reborn:git1$ git branch -d test1 error: The branch 'test1' is not a strict subset of your current HEAD. If you are sure you want to delete it, run 'git branch -D test1'. acs@reborn:git1$ git branch * master
Merge branches
acs@reborn:git1$ git branch test1 acs@reborn:git1$ git checkout test1 Switched to branch "test1" acs@reborn:git1$ vi README acs@reborn:git1$ git commit README acs@reborn:git1$ git checkout master Switched to branch "master" acs@reborn:git1$ git merge test1 Updating 89235a5..d705aa9 Fast forward README | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
git-rebase
Logs
acs@reborn:git1$ git log
commit d705aa99f807c8bc352f60dc1ded231883f2b520
Author: Alvaro del Castillo <acs@reborn.(none)>
Date: Sat Nov 17 19:37:27 2007 +0100
Only in this branch
commit 89235a5f24f78704185c2be29e231e2edeae998e
Author: Alvaro del Castillo <acs@reborn.(none)>
Date: Sat Nov 17 19:30:51 2007 +0100
Primer commit
git-cherry-pick
Clone a GIT repository
git-clone
Publish a GIT repository
git push, git pull
Notas de la charla de KaL
live.gnome.org -> página de trucos de git