简体   繁体   English

如何从远程存储库获取拉动状态/最新状态?

[英]How to get Pull Status/Up-To-Date status from Remote Repository?

I'm using the Library "libgit2sharp" to integrate into my project where I want to check if my local repository is up-to-date with the remote repository, pull/commit wise. 我正在使用库“libgit2sharp”集成到我的项目中,我想检查我的本地存储库是否与远程存储库是最新的,拉/提交。

I want to know this, so if it's not up to date, I then do a "Pull" and do some other stuff in my program. 我想知道这一点,所以如果它不是最新的,那么我会做一个“拉”并在我的程序中做一些其他的事情。

And If it IS up-to-date, I need to know that somehow. 如果它是最新的,我需要以某种方式知道。

What can you do in the library to achieve this functionality? 你可以在库中做些什么来实现这个功能?

One way would be to perform a git fetch, as described in libgit2sharp git-fetch . 一种方法是执行git fetch,如libgit2sharp git-fetch中所述

Check what has been created by the fetch like TestHelpers/ExpectedFetchState.cs does: it nothing has been added (no branch/tags/commit), then your repo is up-to-date. 检查像TestHelpers/ExpectedFetchState.cs这样的提取所创建的内容:它没有添加任何内容(没有分支/标记/提交),那么你的repo是最新的。

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

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