Commit baf163e0 authored by Eric J. Holmes's avatar Eric J. Holmes

Check if a remote master branch exists before die, track it if no local master branch exists

parent 0d00b698
......@@ -117,8 +117,14 @@ cmd_default() {
# check existence in case of an already existing repo
if [ "$should_check_existence" = "YES" ]; then
git_local_branch_exists "$master_branch" || \
# if no local branch exists and a remote branch of the same
# name exists, checkout that branch and use it for master
if ! git_local_branch_exists "$master_branch" && \
git_remote_branch_exists "origin/$master_branch"; then
git branch "$master_branch" "origin/$master_branch" >/dev/null 2>&1
elif ! git_local_branch_exists "$master_branch"; then
die "Local branch '$master_branch' does not exist."
fi
fi
# store the name of the master branch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment