GIT creando y cambiando de rama

Las ramas GITs permiten separar el código de experimentación del de producción. La convención GIT es tratar master como la línea principal de desarrollo. Usted puede renombrarla como desee pero es bueno mantener la convención.

Usted puede crear una nueva rama utilizando el comando git branch y suministrando al menos un parámetro adicional, el nombre de la rama. Esto hace que su ubicación actual en el repositorio como la ubicación para crear la rama.

$ git checkout master
Switched to branch 'master'

GIT Visualizando branches y tags

Visualizando las ramas locales.

$ git branch
  f15
* master
  rebase

Visualizando todas las ramas remotas.

$ git branch -r
  origin/HEAD -> origin/master
  origin/f13
  origin/f15
  origin/fc3
  origin/fc4
  origin/fc5
  origin/master
  origin/rebase

Visualizando todas las ramas disponibles.

$ git branch -a
  f15
* master
  rebase
  remotes/origin/HEAD -> origin/master
  remotes/origin/f13
  remotes/origin/f15
  remotes/origin/fc3
  remotes/origin/fc4
  remotes/origin/fc5
  remotes/origin/master
  remotes/origin/rebase

GIT estado del repositorio

[gomix@movix software-management-guide]$ git status 
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   es-ES/Book_Info.xml
#       modified:   es-ES/Extensiones_Yum.xml
#       modified:   es-ES/Introduccion_a_la_gestion_del_software.xml
#       modified:   es-ES/Las_interfases_GUI_de_gnome-packagekit.xml
#       modified:   es-ES/Software_Management_Guide.xml
#       modified:   es-ES/Uso_del_comando_yum.xml
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       es-ES/Las_interfases_GUI_de_kpackagekit.xml
#       es-ES/images/gnome-packagekit/
#       es-ES/images/kpackagekit/
#       publish/
#       tmp/
no changes added to commit (use "git add" and/or "git commit -a")

git diff

Comparando el mismo archivo en diferentes ramas

$ git diff <ramaA> <ramaB> -- <archivo>
[gomix@movix software-management-guide]$ git diff f16 rebase -- es-ES/Book_Info.xml
diff --git a/es-ES/Book_Info.xml b/es-ES/Book_Info.xml
index d5f30ae..6d91504 100644
--- a/es-ES/Book_Info.xml
+++ b/es-ES/Book_Info.xml
@@ -6,12 +6,13 @@
 <bookinfo id="book-Manual_para_gestion_del_software-Manual_para_gestion_del_software">
        <title>Manual para gestión del software</title>
        <subtitle>La guía definitiva para la gestión del software</subtitle>
-       <productname>Fedora 16</productname>
-       <productnumber></productnumber>
-       <edition>1</edition>
+       <productname>Fedora</productname>
+       <productnumber>14</productnumber>
+       <edition>1.0</edition>
        <pubsnumber>0</pubsnumber>
        <abstract>
-               <para>Este manual está dedicado a la gestión del software en Fedora. El lector adquirirá las habilidad
+               <para>
+                       Este manual está dedicado a la gestión del software en Fedora. El lector adquirirá las habilid
                </para>
        </abstract>
        <corpauthor>

Comparando dos archivos en ramas diferentes:

git diff <ramaA>:<archivoA> <ramaB>:<archivoB>

git merge

[gomix@movix software-management-guide]$ git branch 
  f15
  f16
* master
  rebase
[gomix@movix software-management-guide]$ git merge f16   ;fusionar cambios de la rama f16 en la rama master
Auto-merging es-ES/Book_Info.xml
CONFLICT (content): Merge conflict in es-ES/Book_Info.xml
Auto-merging .tx/config
CONFLICT (add/add): Merge conflict in .tx/config
Automatic merge failed; fix conflicts and then commit the result.

git diff

[gomix@movix software-management-guide]$ git diff
diff --cc .tx/config
index 27fdd0d,02165aa..0000000
--- a/.tx/config
+++ b/.tx/config
@@@ -1,3 -1,5 +1,8 @@@
  [main]
  host = https://www.transifex.net
  lang_map = aln:aln-AL, ar:ar-SA, as:as-IN, bal:bal-PK, bg:bg-BG, bn:bn-BD, bn_IN:bn-IN, bs:bs-BA, ca:ca-ES, cs:cs-CZ, da:da-DK, de_CH:de-CH, de:de-DE, el:el
++<<<<<<< HEAD
++=======
+ 
+ 
++>>>>>>> f16
diff --cc es-ES/Book_Info.xml
index 7a7d587,6f94e65..0000000
--- a/es-ES/Book_Info.xml
+++ b/es-ES/Book_Info.xml
@@@ -6,10 -6,10 +6,17 @@@
  <bookinfo id="book-Manual_para_gestion_del_software-Manual_para_gestion_del_software">
        <title>Manual para gestión del software</title>
        <subtitle>La guía definitiva para la gestión del software</subtitle>
++<<<<<<< HEAD
 +      <productname>Fedora 17</productname>
 +      <productnumber></productnumber>
 +      <edition>1</edition>
 +      <pubsnumber>0</pubsnumber>
++=======
+       <productname>Fedora</productname>
+   <productnumber>16</productnumber>
+       <edition>1.0</edition>
+   <pubsnumber>0</pubsnumber>
++>>>>>>> f16
        <abstract>
                <para>Este manual está ded

Le mostrará los archivos en problemas, edítelos, y agreguélos o remuévalos (git add/rm) para resolver el conflicto, luego simplemente git commit -a.

Enlaces

Páginas hijas

Documentación adicional

Es mucha:

$ rpm -qd git   | wc -l
742