git flow在任何时候都只允许一个修复分支。因此,与其键入:
git flow hotfix finish hotfix_branch我喜欢创建一个别名,它使用唯一现存的hotfix分支名称。类似于以下伪代码:
[alias]
fix-done = flow hotfix finish `git_fetch_branch_beginning_with_hotfix`有人能帮忙吗?谢谢。
更新:我正在使用zsh。
发布于 2012-10-30 13:16:21
这个函数或多或少是从git-流的源代码中提取出来的:
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"
}更新
似乎你必须把整个函数放在你的别名里。不太好,但效果很好:
[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\"; }; _"发布于 2016-02-01 22:50:55
下面是另一种执行git流修补程序完成别名的方法:
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; }; _"发布于 2016-02-02 16:17:51
如果您运行git流AVH版,您可以只执行以下操作
$ git flow finish当你在树枝上时,你想要完成。这适用于修复、发布、特性和错误修复。
检查是否运行git流AVH版
$ git flow version
x.xx.x (AVH Edition)https://stackoverflow.com/questions/13134841
复制相似问题