简体   繁体   English

C#如何检查git存储库是否已更新

[英]C# How to check if git repository was updated

I would like to do a C# program that checks every x times if an online git repository (let's say a specific subdirectory) was updated and if so, download it to a specific folder. 我想做一个C#程序,它每隔x次检查一次在线git信息库(例如特定的子目录)是否已更新,如果已更新,请将其下载到特定的文件夹中。 The thing is that I don't even know how to do the first step. 问题是我什至不知道如何做第一步。 I looked up the internet and I found a library called libgit2sharp. 我上网查询,发现一个名为libgit2sharp的库。 I don't know git very well but I saw that I can get the sha string of a commit with libgit2sharp so maybe that could help. 我不太了解git,但是我发现我可以使用libgit2sharp获取提交的sha字符串,因此也许可以帮上忙。 Any idea? 任何想法?

Thanks in advance 提前致谢

Use the git 'fetch' command to check for new commits. 使用git'fetch'命令检查新提交。

You can also use gitbash and parse the result it is quite simple. 您还可以使用gitbash解析结果,这非常简单。

see http://git-scm.com/docs/git-fetch 参见http://git-scm.com/docs/git-fetch

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

相关问题 如何检查目录是否是 C# 中的 git 存储库 - How to check if a directory is a git repository in C# 如何通过C#获取存储库git中文件的编码? - How to get the encoding of a file in a repository git via C#? 如何使用C#从git存储库中检索文件历史记录? - How to retrieve file history from git repository using c#? 如何检查是否在C#中添加,更新或删除了SortedDictionary - How to check if a SortedDictionary is being added, updated or deleted in C# 如果更新成功,如何检查 MongoDB C# 驱动程序? - How to check in MongoDB C# Driver if updated successfully? 如何使用ef和c#检查DB中的最新更新值 - How to check last updated value in the DB with ef and c# C#:如何检查打开的文件是否已更新 - C#: How to check if a open file has been updated 如何使用 C# .net Core 执行 git 命令明确给出存储库路径? - How to execute git commands giving repository path explicitly using C# .net Core? 如何将最近添加的 C# Class 库添加到解决方案已连接到的现有 Git 存储库 - How to add a recently added C# Class library to the existing Git repository that the solution is already connected to 从C#运行PowerShell脚本以提取Git存储库 - Running a PowerShell script from C# to Pull Git Repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM