Skip to content

Instantly share code, notes, and snippets.

@ameboide
Created March 22, 2013 15:07
Show Gist options
  • Save ameboide/5221971 to your computer and use it in GitHub Desktop.
Save ameboide/5221971 to your computer and use it in GitHub Desktop.
aliases y scripts para git y hubflow
#log de commits locales que no se han pusheado
alias gl='git log --branches --not --remotes --decorate'
alias gs='git status'
alias gf='git fetch origin'
gco(){
git commit -m "$*"
}
gc(){
git checkout $*
}
alias gcd='git checkout develop'
gcf(){
git checkout feature/$*
}
gcr(){
git checkout release/$*
}
gch(){
git checkout hotfix/$*
}
#updatea la rama actual, develop y master
ghu(){
git pull
git hf update
}
alias ghp='git hf feature push'
ghf(){
git hf feature $*
}
ghr(){
git hf release $*
}
ghh(){
git hf hotfix $*
}
hotfix(){
ghu
#ver que no hayan hotfix abiertos
b=$(git branch -r --list *hotfix/* | sed 's/.\+\///')
if [ $b ]; then
echo 'Está abierto el hotfix "'$b'", hay que finishearlo!'
return 1
fi
#leer archivo VERSION
gc master
v=$(cat VERSION)
echo 'La versión actual es '$v
#vv=version+1
x=$(echo $v | sed 's/.\+\.//')
xx=$(expr $x + 1)
vv=$(echo $v | sed 's/[^.]\+$//')$xx
#startear hotfix
echo 'Creando hotfix '$vv
ghh start $vv
#bump VERSION
echo $vv > VERSION
#changelog
d=$(date +"%A %d de %B %Y")
sed -i "2i\## Hotfix: $vv\n$d\n* **Fixed:** [Hice cosas pero se me olvido cambiar el changelog](#0)\n" CHANGELOG.md
vim CHANGELOG.md
}
release(){
echo 'en construccion...'
return 1
ghu
#leer archivo VERSION
gc master
v=$(cat VERSION)
echo 'La versión actual es '$v
#vs=version.split(.)
#y=date %y
#vv = $vs[0] == $y ? $vs[0].($vs[1] + 1).0 : ($vs[0]).0.0
#startear release
echo 'Creando release '$vv
ghr start $vv
#bump VERSION
echo $vv > VERSION
#changelog
d=$(date +"%A %d de %B %Y")
sed -i "2i\## Release: $vv\n$d\n* [Hice cosas pero se me olvido cambiar el changelog](#0)\n" CHANGELOG.md
vim CHANGELOG.md
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment