Skip to content

Commit 3b2478c

Browse files
authored
Use git init --initial-branch. (#26)
1 parent 901c47b commit 3b2478c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hooks/post_gen_project.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def main() -> None:
4141
if "{{ cookiecutter.add_readthedocs }}" == "no":
4242
remove_file(project_path, ".readthedocs.yaml")
4343

44-
subprocess.run(("git", "init"), check=True, capture_output=True)
44+
subprocess.run(
45+
("git", "init", "--initial-branch", "main"), check=True, capture_output=True
46+
)
4547

4648
if "{{ cookiecutter.make_initial_commit }}" == "yes":
4749
# Create an initial commit on the main branch and restore global default name.
@@ -59,7 +61,6 @@ def main() -> None:
5961
check=True,
6062
capture_output=True,
6163
)
62-
subprocess.run(("git", "branch", "-m", "main"), check=True)
6364

6465
if "{{ cookiecutter.create_conda_environment_at_finish }}" == "yes":
6566
if shutil.which("mamba") is not None:

0 commit comments

Comments
 (0)