Needing a little help performing operations on remote repository

雨燕双飞 提交于 2019-12-11 18:05:37

问题


I've been tinkering around, and reading through what little Wiki information that I could find, and looked through tests that I thought may be relevant, however I'm having problems coming up with a working solution for a few things.

Mostly, I'm looking for a way to list commits that have been pushed to the server ahead of your working repository / local commits. I've tried using Fetch, and FetchHeads, but looking through all of the documentation for the Network class doesn't seem to yield anything that I can understand, I guess. Ideally, I'd be interested in seeing something like:

    IQueriableCommitLog Repository.Network.GetCommitsAhead

OR

    IQueriableCommitLog Repository.Remote.GetCommitsAhead

Then, just use the results like you would in:

    IQueriableCommitLog Repository.Commits

Also, perhaps a method like Commit.UpdateTo() for the remote commit.

Am I too far off base for what I'm looking for? Is it possible at this time to perform actions such as this? Is it supported by libgit2?


回答1:


Mostly, I'm looking for a way to list commits that have been pushed to the server ahead of your working repository / local commits.

A Branch is either local or remote. Local Branches which are tracking other ones expose a TrackedBranch property.

Considering a local branch with a not null TrackedBranch property

  • Commits that have been performed on this local branch and aren't known from the tracked one.

repo.Commits.QueryBy(new Filter { Since = branch.Tip, Until = branch.TrackedBranch });

  • Commits that exist in the tracked branch and aren't known from the local one

repo.Commits.QueryBy(new Filter { Since = TrackedBranch, Until = Tip })



来源:https://stackoverflow.com/questions/14701119/needing-a-little-help-performing-operations-on-remote-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!