automatically commit the project to git

This commit is contained in:
Jeff Epler 2020-08-08 20:01:04 -05:00
parent 18905d1080
commit d587c0c20c

20
hooks/post_gen_project.py Normal file
View file

@ -0,0 +1,20 @@
# -*- python3 -*-
import subprocess
def step(args):
try:
subprocess.run(args, check=True)
except subprocess.CalledProcessError as e:
raise SystemExit(e.returncode)
try:
subprocess.run(['git', 'version'], check=True)
except subprocess.CalledProcessError as e:
print("Coult not execute git - Did not create initial commit"
step(["git", "init"])
step(["git", "add", "."])
step(["git", "commit", "-m", "initial commit, created by cookiecutter-mystl"])
step(["git", "branch", "-m", "{{ cookiecutter.main_branch_name }}"])
print("Successfully made initial commit of project")