有没有办法在git(-flow)挂钩期间运行交互式shell命令?

时间:2015-01-19 10:04:03

标签: git hook git-flow

我想为git flow编写一个git hook,它在完成一个功能分支时启动一个交互式rebase并自动压缩提交。

目前我喜欢的内容如下:

#!/bin/sh
#
# Runs before git flow feature finish
#
# Positional arguments:
# $1    The friendly name of the branch
# $2    The origin remote
# $3    The full branch name (including the feature prefix)
#
# The following variables are available as they are exported by git-flow:
#
# MASTER_BRANCH - The branch defined as Master
# DEVELOP_BRANCH - The branch defined as Develop
#
NAME=$1
ORIGIN=$2
BRANCH=$3

# Implement your script here.
`git rebase -i $DEVELOP_BRANCH`
# To terminate the git-flow action, return a non-zero exit code.
exit 0

但是,这不会打开rebase窗口,而是会阻止任何事情发生。

1 个答案:

答案 0 :(得分:0)

我输错了:

git rebase -i "$DEVELOP_BRANCH"

这很有用。