简体   繁体   English

如何使用libgit2提交裸存储库中的特殊分支?

[英]how to commit to a special branch in a bare repository with libgit2?

I want implement a blog web app with history record feature based on Git. 我希望实现一个基于Git的具有历史记录功能的博客Web应用程序。 First, considering use git init --bare to save blog content. 首先,考虑使用git init --bare来保存博客内容。

But how could I do commit with a special branch? 但我怎么能提交一个特殊的分支?

I know, normally git shell command can't achieve commit operation to a bare repo if not checkout a branch to workspace. 我知道,如果没有签出分支到工作区,通常git shell命令无法实现对裸仓库的提交操作。

Besides, github can edit and commit a file change to a specify branch if the repo is owned by yourself. 此外,如果repo由您自己拥有,github可以编辑并将文件更改提交到指定分支。

how about libgit2? libgit2怎么样?

Thanks 谢谢

With some struggle, I find libgit2 can create blob, tree and commit in buffer. 经过一番努力,我发现libgit2可以在缓冲区中创建blob,tree和commit。

There are sample code in GitHub but not document well yet.Hope it will be some help. GitHub中示例代码,但还没有文档。希望它会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM