Add checks for all the commands, to assure we're working in a clean and safe environment, before actually modifying stuff in the repo.
diff --git a/gitflow-feature b/gitflow-feature
index 6551b99..adad481 100755
--- a/gitflow-feature
+++ b/gitflow-feature
@@ -32,17 +32,32 @@
}
start() {
- # TODO
parse_args "$@"
+
+ # Checks
gitflow_check_clean_working_tree
+ gitflow_require_branch_absent "$FEATURE"
+ if [ "$BASE" = "develop" ]; then
+ gitflow_require_branches_equal 'develop' 'origin/develop'
+ fi
+
+ # All checks passed, ready to roll
echo "git checkout -b $FEATURE $BASE"
}
finish() {
- # TODO
parse_args "$@"
+
+ # Checks
gitflow_check_clean_working_tree
+ gitflow_require_branch "$FEATURE"
+ if [ "$BASE" = "develop" ]; then
+ gitflow_require_branches_equal 'develop' 'origin/develop'
+ fi
+
+ # All checks passed, ready to roll
echo "git checkout $BASE"
echo "git merge --no-ff $FEATURE"
+ echo "git branch -d $FEATURE"
}