我正在开发定制的VS扩展,它将为Visual中的git源代码管理插件添加更多的UI。UI已经完成。
Visual中是否有一些API可用于调用git相关命令(例如,git提取)或检索与git相关的设置,例如存储库url?
发布于 2017-09-22 05:45:11
您可以通过带有进程的C#代码调用git命令。请参考以下示例代码。
string gitCommand = "git";
string gitAddArgument = @"add -A" ;
string gitCommitArgument = @"commit ""explanations_of_changes"" "
string gitPushArgument = @"push our_remote"
Process.Start(gitCommand, gitAddArgument );
Process.Start(gitCommand, gitCommitArgument );
Process.Start(gitCommand, gitPushArgument );您还可以尝试使用LibGit2Sharp NuGet包,这是一个本地的Git实现。关于如何在C#中使用它,请参考下面的博客。
http://blog.somewhatabstract.com/2015/06/22/getting-information-about-your-git-repository-with-c/
https://stackoverflow.com/questions/46347076
复制相似问题