Include a globally available variable GIT_DIR, that points to the .git directory.

Add a function that tests whether a specific commit is already merged into the given target branch.
diff --git a/git-flow b/git-flow
index 5fbbf8c..8e2fa78 100755
--- a/git-flow
+++ b/git-flow
@@ -18,6 +18,7 @@
 	set -x
 fi
 
+export GIT_DIR=$(git rev-parse --git-dir)
 export GITFLOW_DIR=$(dirname "$0")
 export MASTER_BRANCH=$(git config --get gitflow.branch.master || echo master)
 export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop || echo develop)
@@ -162,4 +163,16 @@
 	fi
 }
 
+#
+# gitflow_is_branch_merged_into()
+#
+# Checks whether branch $1 is succesfully merged into $2
+#
+gitflow_is_branch_merged_into() {
+	local SUBJECT=$1
+	local BASE=$2
+	ALL_MERGES=$(git branch --contains $SUBJECT | sed 's/^[* ] //')
+	has $BASE $ALL_MERGES
+}
+
 main "$@"