Skip to content

Commit

Permalink
Merge pull request #127 from vpodzime/master-init_main_branch
Browse files Browse the repository at this point in the history
Use "main" as the initial branch for 'git init'
  • Loading branch information
vpodzime authored Sep 23, 2022
2 parents 3cb9837 + 94343bb commit 93828a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cfbs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def git_set_config(key, value):
return True


def git_init(user_name=None, user_email=None, description=None):
def git_init(user_name=None, user_email=None, description=None, initial_branch="main"):
"""Initialize git repo in CWD
Also initializes `user.name` and `user.email` Git config for the repo if
Expand All @@ -68,7 +68,7 @@ def git_init(user_name=None, user_email=None, description=None):

try:
# Suppress noisy hint output on stderr:
check_call(["git", "init"], stderr=DEVNULL)
check_call(["git", "init", "-b", initial_branch], stderr=DEVNULL)
except CalledProcessError as cpe:
raise CFBSGitError("Failed to initialize git repository") from cpe

Expand Down

0 comments on commit 93828a9

Please sign in to comment.