Add some example hook scripts.
diff --git a/git-flow-feature b/git-flow-feature
index f362f08..3994729 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -211,11 +211,15 @@
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
+ run_pre_hook "$NAME" "$ORIGIN" "$BRANCH" "$BASE"
+
# create branch
if ! git checkout -b "$BRANCH" "$BASE"; then
die "Could not create feature branch '$BRANCH'"
fi
+ run_post_hook "$NAME" "$ORIGIN" "$BRANCH" "$BASE"
+
echo
echo "Summary of actions:"
echo "- A new branch '$BRANCH' was created, based on '$BASE'"
@@ -296,6 +300,8 @@
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
+ run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
+
# if the user wants to rebase, do that first
if flag rebase; then
if ! git flow feature rebase "$NAME" "$DEVELOP_BRANCH"; then
@@ -331,6 +337,8 @@
exit 1
fi
+ run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
+
# when no merge conflict is detected, just clean up the feature branch
helper_finish_cleanup
}
@@ -377,6 +385,8 @@
git fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
+ run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
+
# create remote branch
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q "$ORIGIN"
@@ -386,6 +396,8 @@
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git checkout "$BRANCH"
+ run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
+
echo
echo "Summary of actions:"
echo "- A new remote branch '$BRANCH' was created"
@@ -401,12 +413,17 @@
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
+
+ run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
+
git fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
+ run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
+
echo
echo "Summary of actions:"
echo "- A new remote tracking branch '$BRANCH' was created"
diff --git a/hooks/pre-flow-feature-finish b/hooks/pre-flow-feature-finish
new file mode 100755
index 0000000..d81afa1
--- /dev/null
+++ b/hooks/pre-flow-feature-finish
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# Ran 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)
+#
+NAME=$1
+ORIGIN=$2
+BRANCH=$3
+
+# Implement your script here.
+# To terminate the git-flow action, return a non-zero exit code.
+exit 0
diff --git a/hooks/pre-flow-feature-publish b/hooks/pre-flow-feature-publish
new file mode 100755
index 0000000..445a28b
--- /dev/null
+++ b/hooks/pre-flow-feature-publish
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# Ran before git flow feature publish
+#
+# Positional arguments:
+# $1 The friendly name of the branch
+# $2 The origin remote
+# $3 The full branch name (including the feature prefix)
+#
+NAME=$1
+ORIGIN=$2
+BRANCH=$3
+
+# Implement your script here.
+# To terminate the git-flow action, return a non-zero exit code.
+exit 0
diff --git a/hooks/pre-flow-feature-pull b/hooks/pre-flow-feature-pull
new file mode 100755
index 0000000..23baafb
--- /dev/null
+++ b/hooks/pre-flow-feature-pull
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# Ran before git flow feature pull.
+#
+# Positional arguments:
+# $1 The friendly name of the branch
+# $2 The remote to pull from
+# $3 The full branch name (including the feature prefix)
+#
+NAME=$1
+REMOTE=$2
+BRANCH=$3
+
+# Implement your script here.
+# To terminate the git-flow action, return a non-zero exit code.
+exit 0
diff --git a/hooks/pre-flow-feature-start b/hooks/pre-flow-feature-start
new file mode 100755
index 0000000..818418e
--- /dev/null
+++ b/hooks/pre-flow-feature-start
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Ran before git flow feature start
+#
+# Positional arguments:
+# $1 The friendly name of the branch
+# $2 The origin remote
+# $3 The full branch name (including the feature prefix)
+# $4 The base from which this feature is started
+#
+NAME=$1
+ORIGIN=$2
+BRANCH=$3
+BASE=$4
+
+# Implement your script here.
+# To terminate the git-flow action, return a non-zero exit code.
+exit 0
diff --git a/hooks/pre-flow-feature-track b/hooks/pre-flow-feature-track
new file mode 100755
index 0000000..c30419b
--- /dev/null
+++ b/hooks/pre-flow-feature-track
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# Ran before git flow feature track
+#
+# Positional arguments:
+# $1 The friendly name of the branch
+# $2 The origin remote
+# $3 The full branch name (including the feature prefix)
+#
+NAME=$1
+ORIGIN=$2
+BRANCH=$3
+
+# Implement your script here.
+# To terminate the git-flow action, return a non-zero exit code.
+exit 0