GitPython-创建一个空存储库

GitPython-创建一个空存储库,python,gitpython,Python,Gitpython,目前,我可以使用以下内容创建存储库 repo = Repo('my_path_to.git') repo.git.branch('feature') # To use it I just do. I am not sure if this is correct. repo.git.checkout('feature') 假设master已经存在,但我不想从master到feature签出。相反,我希望特性是一个完全空的分支 有人知道如何使用GitPython吗? 有没有比我上面演示的更安全的方

目前,我可以使用以下内容创建存储库

repo = Repo('my_path_to.git')
repo.git.branch('feature')
# To use it I just do. I am not sure if this is correct.
repo.git.checkout('feature')
假设master已经存在,但我不想从master到feature签出。相反,我希望特性是一个完全空的分支

有人知道如何使用GitPython吗? 有没有比我上面演示的更安全的方法来创建分支

非常感谢