docs/socialserv/2023-03-15-gitflowCheetShee...

192 lines
4.1 KiB
Markdown
Raw Normal View History

---
title: CHEETSHEET DE GIT Y GITFLOW ES
author: Decentralized Climate Foundation
date: 2023-03-15
category: git-flow
layout: post
---
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
## GIT
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
---
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
### Comandos de Git basicos o frecuentes
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
```shell
2023-02-15 15:48:42 +00:00
2023-02-20 16:52:11 +00:00
$ git init # Crear un nuevo git
2023-02-15 18:08:05 +00:00
2023-02-20 16:52:11 +00:00
$ git add # Agregar archivos al area de preparacion
2023-02-15 18:08:05 +00:00
2023-02-20 16:52:11 +00:00
$ git status # Estado del repositorio
2023-02-15 18:08:05 +00:00
$ git commit -m # pasar archivos del area de preparacion al repositorio local
2023-02-15 18:08:05 +00:00
2023-02-20 16:52:11 +00:00
$ git log # ver las versiones de archivos del repositorio
2023-02-15 18:08:05 +00:00
2023-02-20 16:52:11 +00:00
$ git clone # clonar un repositorio remoto
2023-02-15 18:08:05 +00:00
2023-02-20 16:52:11 +00:00
$ git push # modificar el repositorio remoto, con su nueva actualizacion
2023-02-15 18:08:05 +00:00
2023-02-20 16:52:11 +00:00
$ git pull # actualizar tu repositorio local con la ultima version del remoto
2023-02-15 18:08:05 +00:00
2023-02-20 16:52:11 +00:00
$ git add . # sirve para agregar todos los archivos modificados al area de preparacion
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
```
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
---
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
## GIT FLOW
---
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
### Instalar en linux debian
Para instalar git flow, se requiere tener previamente git, y se executan los siguientes comandos en tu terminal ya sea con sudo o como root.
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
```
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
$ sudo apt-get update
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
$ sudo apt-get install git-flow
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
```
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
### INICIALIZAR
Una vez que estas dentro de tu directorio git o repositorio clonado, inicializa el git flow:
```
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
$ git flow init
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
```
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
### RAMAS DE GIT FLOW
![](https://www.campingcoder.com/post/20180412-git-flow.png)
* **Master**: Rama principal que mantiene la version estable de un software.
* **Develop**: Rama que se utiliza por uno o varios programadores para un software en modo pruebas.
* **Feature**: Rama temporal o local, que sirve para que cada programador desarrolle alguna funcion especifica (Libreria, funcion, clase, etc.).
* **Release**: Rama temporal solo para publicar las etiquetas de versiones y sincronizar develop con master, esto se hace cuando tenemos una version estable de software o un punto para entregable.
* **Hotfix**: Rama temporal que se utiliza para arreglar errores criticos o bugs en el codigo de produccion, generalmente se utiliza en modo de emergencia.
#### FEATURES
---
**1. COMENZAR UNA CARACTERISTICA (FEATURE)**
```
2023-02-20 16:52:11 +00:00
$ git flow feature start MYFEATURE
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
```
2023-02-20 16:52:11 +00:00
> Cambiar `MYFEATURE` por el nombre que le quieras dar a tu característica.
2023-02-15 18:08:05 +00:00
---
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
**2. FINALIZAR UNA CARACTERISTICA**
```
2023-02-15 15:48:42 +00:00
2023-02-20 16:52:11 +00:00
$ git flow feature finish MYFEATURE # Finaliza el desarrollo de una cacteristica.
2023-02-15 15:48:42 +00:00
2023-02-20 16:52:11 +00:00
$OBTENIENDO CARACTERISTICAS PUBLICADAS
2023-02-15 15:48:42 +00:00
2023-02-20 16:52:11 +00:00
$ git flow feature pull origin MYFEATURE # Obten una caracteristica publicada por otro.
2023-02-15 15:48:42 +00:00
2023-02-20 16:52:11 +00:00
$ git flow feature track MYFEACTURE # Puedes mantener un seguimiento de tus cambios.
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
```
#### RELEASE
---
**COMO PUBLICAR UNA VERSION**
```
2023-02-20 16:52:11 +00:00
$ git checkout master
$ git pull
$ git checkout develop
$ git pull
$ git flow release start 1.0
$ git flow release publish 1.0
$ git flow release finish 1.0
$ git push origin --all --follow-tags
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
```
---
#### HOTFIX
---
**COMO PUBLICAR HACER UN HOTFIX**
```
2023-02-15 15:48:42 +00:00
2023-02-20 16:52:11 +00:00
$ git checkout develop
$ git pull
$ git checkout master
$ git pull
$ git flow hotfix start (Nombre)
2023-02-20 16:52:11 +00:00
# Hacer cambios
$ git status # verifique el archivo de color rojo
$ git add . # agregar archivos
$ git commit -m 'Escribe un comentario'
$ git flow hotfix finish (name)
# Recuerda poner una etiqueta de versión fija 1.2.x por ejemplo 1.2.2
# estabas en el maestro, y luego debes estar en la rama de desarrollo
$ git push origin --all --follow-tags
2023-02-22 15:44:41 +00:00
2023-02-15 18:08:05 +00:00
```
## LICENSE
```
Copyright (C) 2023 DECENTRALIZED CLIMATE FOUNDATION A.C.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
```
## CONTACTO Y DESARROLLADORES
> Work developed in collaboration with the [Decentralized Climate Foundation](https://decentralizedclimate.org).
- [Gustavo Bermudez](nizaries44@gmail.com)
2023-02-22 15:44:41 +00:00
Revisor:
- [David E. Perez Negron R.](mailto:david@neetsec.com)
---
2023-02-15 18:08:05 +00:00
## REFERENCIAS
2023-02-20 17:56:10 +00:00
\[1\] Daniel Kummer, "Git-flow cheatsheet", https://danielkummer.github.io/git-flow-cheatsheet/index.html), 2023.
2023-02-15 15:48:42 +00:00
2023-02-15 18:08:05 +00:00
\[2\] www.campingcoder.com, "How to use git flow", https://www.campingcoder.com/2018/04/how-to-use-git-flow/, 2023.