Functionally implement the gitflow-hotfix subcommand.
diff --git a/gitflow-hotfix b/gitflow-hotfix
index 7ee8459..b1e8834 100755
--- a/gitflow-hotfix
+++ b/gitflow-hotfix
@@ -15,12 +15,22 @@
usage() {
echo "usage: gitflow start hotfix <release>"
echo " gitflow finish hotfix <release>"
+ # TODO
+ #echo ""
+ #echo "options:"
+ #echo "--option Explanation"
+ #echo ""
+ #echo "start-only options:"
+ #echo "--option Explanation"
+ #echo ""
+ #echo "finish-only options:"
+ #echo "--push Push to the origin repo when finished"
}
parse_args() {
RELEASE="$1"
if [ "$RELEASE" = "" ]; then
- echo "Missing argument <release>."
+ echo "Missing argument <release>"
usage
exit 1
fi
@@ -36,8 +46,19 @@
gitflow_require_branch_absent "$HOTFIX_BRANCH"
# All checks passed, ready to roll
- echo "git checkout -b \"$HOTFIX_BRANCH\" master"
- echo "Don't forget to bump the version number now."
+ git checkout -b "$HOTFIX_BRANCH" master
+
+ echo ""
+ echo "Summary of actions:"
+ echo "- A new branch '$HOTFIX_BRANCH' was created, based on 'master'"
+ echo "- You are now on branch '$HOTFIX_BRANCH'"
+ echo ""
+ echo "Follow-up actions:"
+ echo "- Bump the version number now!"
+ echo "- Start committing your hot fixes"
+ echo "- When done, run:"
+ echo ""
+ echo " gitflow finish hotfix '$HOTFIX_BRANCH'"
}
finish() {
@@ -46,17 +67,29 @@
# Checks
gitflow_check_clean_working_tree
- echo "git fetch origin"
- git fetch origin
+ git fetch origin develop # TODO: Make a flag to skip these fetches
+ git fetch origin master # TODO: Make a flag to skip these fetches
gitflow_require_branches_equal 'master' 'origin/master'
gitflow_require_branches_equal 'develop' 'origin/develop'
# All checks passed, ready to roll
- echo "git checkout master"
- echo "git merge --no-ff \"$HOTFIX_BRANCH\""
- echo "git tag \"$RELEASE\""
- echo "git checkout develop"
- echo "git merge --no-ff \"$HOTFIX_BRANCH\""
- echo "git branch -d \"$HOTFIX_BRANCH\""
+ git checkout master
+ git merge --no-ff "$HOTFIX_BRANCH"
+ git tag "$RELEASE"
+ git checkout develop
+ git merge --no-ff "$HOTFIX_BRANCH"
+ git branch -d "$HOTFIX_BRANCH"
+
+ # TODO: Implement an optional push to master
+ # git push origin develop; git push origin master; git push --tags origin
+
+ echo ""
+ echo "Summary of actions:"
+ echo "- Latest objects have been fetched from 'origin'"
+ echo "- Hotfix branch has been merged into 'master'"
+ echo "- The hotfix was tagged '$RELEASE'"
+ echo "- Hotfix branch has been back-merged into 'develop'"
+ echo "- Hotfix branch '$HOTFIX_BRANCH' has been deleted"
+ echo ""
}