Made the finishing of release/hotfix branches fail-safe. When a
release/hotfix branch fails finishing, the user may just try so again.
diff --git a/git-flow-release b/git-flow-release
index 03832b7..8c12f65 100644
--- a/git-flow-release
+++ b/git-flow-release
@@ -176,22 +176,40 @@
 	gitflow_require_branches_equal $MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
 	gitflow_require_branches_equal $DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
 
-	# merge into master
-	git checkout $MASTER_BRANCH || \
-	  die "Could not check out $MASTER_BRANCH."
-	git merge --no-ff $BRANCH	# TODO: This can fail!
+	# try to merge into master
+	# in case a previous attempt to finish this release branch has failed,
+	# but the merge into master was successful, we skip it now
+	if ! gitflow_is_branch_merged_into $BRANCH $MASTER_BRANCH; then
+		git checkout $MASTER_BRANCH || \
+		  die "Could not check out $MASTER_BRANCH."
+		git merge --no-ff $BRANCH || \
+		  die "There were merge conflicts."
+		  # TODO: What do we do now?
+	fi
 
-	typeset opts="-a"
-	flag sign && opts="$opts -s"
-	[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
-	[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
-	git tag $opts "$VERSION_PREFIX$VERSION" || \
-	  die "Tagging failed. Please run finish again to retry."
+	# try to tag the release
+	# in case a previous attempt to finish this release branch has failed,
+	# but the tag was set successful, we skip it now
+	typeset tagname=$VERSION_PREFIX$VERSION
+	if ! gitflow_tag_exists $tagname; then
+		typeset opts="-a"
+		flag sign && opts="$opts -s"
+		[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
+		[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
+		git tag $opts "$tagname" || \
+		  die "Tagging failed. Please run finish again to retry."
+	fi
 
-	# merge into develop
-	git checkout $DEVELOP_BRANCH || \
-	  die "Could not check out $DEVELOP_BRANCH."
-	git merge --no-ff $BRANCH	# TODO: This can fail!
+	# try to merge into develop
+	# in case a previous attempt to finish this release branch has failed,
+	# but the merge into develop was successful, we skip it now
+	if ! gitflow_is_branch_merged_into $BRANCH $DEVELOP_BRANCH; then
+		git checkout $DEVELOP_BRANCH || \
+		  die "Could not check out $DEVELOP_BRANCH."
+		git merge --no-ff $BRANCH || \
+		  die "There were merge conflicts."
+		  # TODO: What do we do now?
+	fi
 
 	# delete branch
 	git branch -d $BRANCH
@@ -203,7 +221,7 @@
 	echo "Summary of actions:"
 	echo "- Latest objects have been fetched from '$ORIGIN'"
 	echo "- Release branch has been merged into '$MASTER_BRANCH'"
-	echo "- The release was tagged '$VERSION_PREFIX$VERSION'"
+	echo "- The release was tagged '$tagname'"
 	echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
 	echo "- Release branch '$BRANCH' has been deleted"
 	echo