3
我们正试图自动提交遗留目录上的更改,其中人们不想使用类似版本控制(叹气)的内容。自动提交存储库中的更改
我使用gitpython每天晚上提交这些更改:
repo = git.Repo(local_directory)
changed_files = [change.a_blob.path for change in repo.index.diff(None)]
if changed_files or repo.untracked_files:
if changed_files:
repo.git.add(update=True)
if repo.untracked_files:
repo.git.add(repo.untracked_files)
repo.git.commit(message='Auto committed')
repo.remotes.origin.push(repo.head)
有时提交失败,“‘git的承诺--message =自动致力于’退出码1返回” - 我不能重现
有什么我做错了吗?我读过,也许我应该使用repo.index进行提交?
最好,克里斯托弗
感谢您的评论!所以用repo.remotes.origin.push(repo.head)推动仍然是一样的? – Schinken
是的,'repo.remotes.origin.push'是正确的......虽然你可能能够逃避不包括'repo.head' –