automatically commit the project to git
This commit is contained in:
parent
18905d1080
commit
d587c0c20c
1 changed files with 20 additions and 0 deletions
20
hooks/post_gen_project.py
Normal file
20
hooks/post_gen_project.py
Normal 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")
|
||||||
Loading…
Reference in a new issue