Gitpybinding
1.0.0
完全git命令綁定Python,與所有Git和Python 2&3版本兼容。
pip install gitbinding
from gitbinding import Git
git = Git ( path = None , direct_output = True )
"""
path:
working directory, None = use current directory.
direct_output:
if direct_output set to False, the output is redirect to command/function return.
"""現在,您可以運行任何git.init() , git.clone("gitrepo destination") , git.commit() , git.push() , git.config()等的任何git命令,
git命令用“ - ”可以用“ _”替換為git rev-parse到git.rev_parse()
您還可以將git命令參數放在單獨的函數中,例如git.clone("gitrepo","destination") 。
當git.clone()完成無錯誤時,路徑將自動移動到克隆目的地。
要更改git二進制位置,請使用:
git.gitbin = "path/to/git/binary"