Skip to content

Commit 25c387c

Browse files
fix: branch existence checks
Co-authored-by: blooper05 <[email protected]>
1 parent 4c86238 commit 25c387c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

git-flow-hotfix

+6-5
Original file line numberDiff line numberDiff line change
@@ -349,17 +349,18 @@ showcommands! Show git commands while executing them
349349

350350
# Sanity checks
351351
require_clean_working_tree
352-
require_branch_absent "$BRANCH"
353-
git_do fetch -q "$ORIGIN"
354-
require_branch "$ORIGIN/$BRANCH"
352+
require_local_branch_absent "$BRANCH"
353+
354+
git_do fetch -q "$ORIGIN" || die "Could not fetch branch '$BRANCH' from remote '$ORIGIN'."
355+
git_remote_branch_exists "$ORIGIN/$BRANCH"
355356

356357
# Create tracking branch
357-
git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
358+
git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH" || die "Could not create branch '$BRANCH'."
358359

359360
echo
360361
echo "Summary of actions:"
361362
echo "- A new remote tracking branch '$BRANCH' was created"
362-
echo "- You are now on branch '$BRANCH'"
363+
echo "- You are now on branch '$(git_current_branch)'"
363364
echo
364365
}
365366

0 commit comments

Comments
 (0)