git flow solo permite una twig de hotfix en cualquier momento. Entonces, en lugar de escribir:
git flow hotfix finish hotfix_branch
Me gustaría crear un alias que use el único nombre de twig de revisión existente. Algo así como el siguiente pseudocódigo:
[alias] fix-done = flow hotfix finish `git_fetch_branch_beginning_with_hotfix`
¿Alguien puede ayudar? Gracias.
Actualización: estoy usando zsh.
Esta function se extrae más o less del código fuente de git-flow :
finish_current_hotfix_branch () { local hotfix_prefix=$(git config --get gitflow.prefix.hotfix) local hotfix_branches=$(echo "$(git branch --no-color | sed 's/^[* ] //')" | grep "^$hotfix_prefix") local first_branch=$(echo ${hotfix_branches} | head -n1) first_branch=${first_branch#$hotfix_prefix} git flow hotfix finish "$first_branch" }
Actualizar
Parece que tienes que poner toda la function en tu alias. No es lindo, pero funciona:
[alias] fix-done ="!_() { p=$(git config --get gitflow.prefix.hotfix); b=$(echo \"$(git branch --no-color | sed 's/^[* ] //')\" | grep \"^$p\"); f=$(echo ${b} | head -n1); f=${f#$p}; git flow hotfix finish \"$f\"; }; _"
Aquí hay otra forma de hacer un alias de git flow hotfix finish:
hf = "!_() { b=$(git rev-parse --abbrev-ref HEAD) && git co master && git pl && git co develop && git pl && git co $b && git rebase master && h=$(echo $b | sed 's/hotfix\\///g') && git flow hotfix finish -m 'new_tag' $h && git co master && git ps && git co develop && git ps && git ps --tags && git poo $b && git br -D $b; }; _"
Si ejecuta git flow AVH Edition, puede hacer
$ git flow finish
cuando estás en la twig que quieres terminar. Esto funciona para revisión, lanzamiento, function y corrección de errores.
Para comprobar si ejecuta git flow AVH Edition
$ git flow version x.xx.x (AVH Edition)