-
-
Save GusGA/9c5baafe4ad4945dd2ed to your computer and use it in GitHub Desktop.
para hacer hotfixes y releases con `hotfix` y `release` y no olvidarse de la version y el changelog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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' | |
alias gd='git difftool --tool=meld -d HEAD &' | |
alias ga='git add -u .;git add .' | |
alias gb='git branch -a' | |
gr(){ | |
git reset $* | |
} | |
gbd(){ | |
git branch -d $* | |
} | |
gco(){ | |
git commit -m "$*" | |
} | |
gst(){ | |
git stash save $(date +"%Y-%m-%d %H:%M:%S")" - $*" | |
} | |
alias gsp='git stash pop' | |
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(){ | |
b=$(git rev-parse --abbrev-ref HEAD) | |
ghf pull --rebase | |
git hf update | |
gc $b | |
} | |
alias ghfp='git hf feature push' | |
alias ghfps='gst;ghfp;gsp' | |
alias ghfpr='git hf feature pull --rebase' | |
ghf(){ | |
git hf feature $* | |
} | |
ghr(){ | |
git hf release $* | |
} | |
ghh(){ | |
git hf hotfix $* | |
} | |
alias gmd='git merge develop' | |
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 %B") | |
sed -i "3i\## Hotfix $vv\n\n$d\n\n* Hice cosas pero se me olvidó cambiar el changelog\n" CHANGELOG.md | |
subl CHANGELOG.md | |
} | |
release(){ | |
ghu | |
#leer archivo VERSION | |
gc master | |
v=$(cat VERSION) | |
echo 'La versión actual es '$v | |
#vv=version+1 | |
vs=(${v//./ }) | |
y=$(date +"%y") | |
if [ ${vs[0]} -eq $y ] | |
then | |
vv=${vs[0]}.$((${vs[1]}+1)).0 | |
else | |
vv=$((${vs[0]}+1)).0.0 | |
fi | |
#startear release | |
echo 'Creando release '$vv | |
ghr start $vv | |
#bump VERSION | |
echo $vv > VERSION | |
#changelog | |
d=$(date +"%A %d %B") | |
sed -i "3i\## Release $vv\n\n$d\n\n* Hice cosas pero se me olvidó cambiar el changelog\n" CHANGELOG.md | |
subl CHANGELOG.md | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment