Ramas (branches) Flashcards

(15 cards)

1
Q

Verificación de la rama actual

A
git branch
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Renombrar master a main

A
git branch -M main
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Crear una nueva rama en local

A
git checkout -b nombre-nueva-rama
git checkout -b develop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Subir una rama creada al repositorio remoto

A
git push -u origin nombre-rama
git push -u origin develop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Verificar las ramas remotas

A
git branch -a
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Proceso para mantener el repositorio sincronizado

A
  1. Crear la rama
git checkout -b nombre-nueva-rama
  1. Verificar que se paso o esta en la rama creada
    git switch rama-destino
  2. Subir la nueva rama al repositorio
git push origin rama-a-subir
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Pasos para integrar cambios de una rama a otra

A
  1. Cambiar a la rama destino
git switch develop
  1. Hacer merge desde esa rama
git merge feature/estructura-básica
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Pasos para mantener el repositorio limpio

Esto solo debe hacerse cuando se ha dejado de trabajado en una rama y los cambios se han integrado a la rama destino

A
  1. Eliminar la rama local
git branch -d feature/estructura-básica
  1. Eliminar la rama remota
git push origin --delete feature/estructura-básica 
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Listar las ramas remotas

A
git branch -r
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Verificar si el nombre de una rama es exacto:

Esto es útil cuando eliminamos una rama que ya no necesitamos y aún después de borrarla sigue apareciendo en la lista de ramas remotas o al ejecutar el comando

git push origin --delete feature/estructura-básica
A
git branch -r | grep feature
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Eliminar una rama local

A
  • eliminación nomal
git branch -d feature/estructura-básica
  • eliminación forzada
git branch -D feature/estructura-básica
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Actualizar el indice remoto y eliminar cualquier referencia local a ramas remotas que ya no existen.

A
git fetch --prune
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Corregir una palabra mal escrita en la descripción de un commit ya subido

A
  1. Verificar que no hayan cambios pendientes
git status
  1. Editar el mensaje del último commit
git commit --amend

Esto abrirá el Editor predeterminado para editar y corregir

  1. Subir (push) el commit corregido
git push --force

NOTA El uso de –force debe hacerse con cuidado ya que sobreescribe el historial remoto solo es seguro cuando se trabaja en una rama como feature

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Verificar si un commit fue corregido antes de hacer git push –force

A
git log -1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Configurar las credenciales para futuras conexiones al repositorio remoto

A
git config --global credential.helper store
How well did you know this?
1
Not at all
2
3
4
5
Perfectly