> git fetch <remote> <branch>
> git checkout <remote>/<branch> -- relative/path/to/file/or/dir
如何使用GitPython实现同样的功能?我正在想办法,但到目前为止还没有雪茄。我目前正在玩下面这样的游戏,但我只是得到了一些错误。我显然没有正确使用git python api。
repo = git.Repo.init("local\repo\path")
devRemote = repo.create_remote(\
"Dev", "http:\\devremote.git")
repo.create_head('master', devRemote.refs.master)
repo.heads.master.set_tracking_branch(devRemote.refs.master)
devOrigin.fetch()
repo.heads.master.checkout("TargetDir/")