jueves, 7 de julio de 2016

Mi acordeón de git

Inicialización

Iniciar un repositorio localmente

$ git init
$ git remote add origin https://github.com/<username>/<repo>.git
$ git remote -v                 // verificar la liga
$ git push -u origin --all      // envía todo lo agregado localmente
Más detalles en Adding an existing project to GitHub using the command line

Clonar una bifurcación (fork)

$ git clone https://github.com/<username<repo>.git

Manipular los archicos

Agregar

$ git add .     // all
$ git add -u    // update
$ git add -A    // both

Remover

$ git rm --cached somefile.ext   // no remueve el archivo original
$ git rm --cached -r somedirectory
$ git rm --cached *~             // remueve archivos de respaldo

Borrar

$ git clean -f -d                // borra todos los archivos que no siga git

Manipular los repositorios

Encomendar (commit)

Registra en el repositorio local:
$ git commit -a -m "mensaje"     // agregar todo & commit
$ git commit -m "mensaje"        // sólo encomendar
$ git commit -m "mensaje" path/to/file.ext // encomendar un archivo

Empujar (Push)

Envía los datos al repo remoto:
$ git push

Ramas (branches)

$ git checkout -b branchname     // crear
$ git branck                     // ¿en qué rama me encuentro?
$ git checkout master

Solicitud de atracción (pull request)

Es cuando se solicita la fusión de ramas en Github.