Commit 9283eaef authored by Vincent Driessen's avatar Vincent Driessen

Add some example hook scripts.

parent 359db205
...@@ -211,11 +211,15 @@ cmd_start() { ...@@ -211,11 +211,15 @@ cmd_start() {
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi fi
run_pre_hook "$NAME" "$ORIGIN" "$BRANCH" "$BASE"
# create branch # create branch
if ! git checkout -b "$BRANCH" "$BASE"; then if ! git checkout -b "$BRANCH" "$BASE"; then
die "Could not create feature branch '$BRANCH'" die "Could not create feature branch '$BRANCH'"
fi fi
run_post_hook "$NAME" "$ORIGIN" "$BRANCH" "$BASE"
echo echo
echo "Summary of actions:" echo "Summary of actions:"
echo "- A new branch '$BRANCH' was created, based on '$BASE'" echo "- A new branch '$BRANCH' was created, based on '$BASE'"
...@@ -296,6 +300,8 @@ cmd_finish() { ...@@ -296,6 +300,8 @@ cmd_finish() {
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi fi
run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
# if the user wants to rebase, do that first # if the user wants to rebase, do that first
if flag rebase; then if flag rebase; then
if ! git flow feature rebase "$NAME" "$DEVELOP_BRANCH"; then if ! git flow feature rebase "$NAME" "$DEVELOP_BRANCH"; then
...@@ -331,6 +337,8 @@ cmd_finish() { ...@@ -331,6 +337,8 @@ cmd_finish() {
exit 1 exit 1
fi fi
run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
# when no merge conflict is detected, just clean up the feature branch # when no merge conflict is detected, just clean up the feature branch
helper_finish_cleanup helper_finish_cleanup
} }
...@@ -377,6 +385,8 @@ cmd_publish() { ...@@ -377,6 +385,8 @@ cmd_publish() {
git fetch -q "$ORIGIN" git fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH" require_branch_absent "$ORIGIN/$BRANCH"
run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
# create remote branch # create remote branch
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH" git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q "$ORIGIN" git fetch -q "$ORIGIN"
...@@ -386,6 +396,8 @@ cmd_publish() { ...@@ -386,6 +396,8 @@ cmd_publish() {
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH" git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git checkout "$BRANCH" git checkout "$BRANCH"
run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
echo echo
echo "Summary of actions:" echo "Summary of actions:"
echo "- A new remote branch '$BRANCH' was created" echo "- A new remote branch '$BRANCH' was created"
...@@ -401,12 +413,17 @@ cmd_track() { ...@@ -401,12 +413,17 @@ cmd_track() {
# sanity checks # sanity checks
require_clean_working_tree require_clean_working_tree
require_branch_absent "$BRANCH" require_branch_absent "$BRANCH"
run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
git fetch -q "$ORIGIN" git fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH" require_branch "$ORIGIN/$BRANCH"
# create tracking branch # create tracking branch
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH" git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
echo echo
echo "Summary of actions:" echo "Summary of actions:"
echo "- A new remote tracking branch '$BRANCH' was created" echo "- A new remote tracking branch '$BRANCH' was created"
......
#!/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
#!/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
#!/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
#!/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
#!/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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment