RubyLit - Ruby.del.litoral!
Usando Git (changes)

Showing changes from revision #6 to #7: Added | Removed

Crear un repositorio nuevo

Crear un nuevo repo de git se hace en dos partes, o al menos así lo hago yo. Una del lado del servidor:

Vamos crear un script en bash que se va a llamar init-repo-server-side.sh

#!/bin/sh 
PROJECT=$1

REPO=/srv/git/$PROJECT.git

echo Creando $REPO ...

mkdir -p $REPO
cd $REPO
git --bare init
chown -R root:src $REPO
chmod g+w $REPO -R
chmod a+x hooks/post-update
touch git-daemon-export-ok


Le damos permisos de ejecución:

chmod a+x init-repo-server-side.sh

Luego en el server ejecutamos:

./init-repo-server-side.sh mi-proyecto

Ahora vamos a nuestra pc o laptop y creamos un script
que se va a llamar init-repo.sh

#!/bin/sh -x

PROJECT=$1.git

URL=ssh://usuario@mi-server.com/srv/git/$PROJECT

echo Creando $PROJECT

mkdir $PROJECT
cd $PROJECT

git init
touch .gitignore
git add .gitignore
git commit -m "just gitignore" 
git remote add origin $URL
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git push --all
git pull

Le damos permisos de ejecución:

chmod a+x init-repo.sh

Entonces ahora en nuestra pc ejecutamos:

./init-repo.sh mi-proyecto-nuevo

y listo con eso tenemos nuestro repositorio listo.

Tags

Creamos el tag:

git tag -a -m "tagging version 1.0" 1.0

Usamos git push con la opción—tags para hacer el push al repo remoto:

git push --tags

Branches

Para crear un branch en el server (repositorio remoto):

Primero creamos una rama local

git checkout -b nueva-rama

Hacemos un cambio y comiteamos:

git commit -a -m 'nuevo cambio desde la nueva rama'

Y hacemos un push a la rama:

git push origin nueva-rama

esto cure panic attacks o esto panic attack treatment nos crea la nueva rama en el server, a partir de ahora cada nuevo push se hace hacia esta rama creada.

para hacer un pull de la rama creda debemos hacer:

git pull origin nueva-rama