libgit2 / libgit2sharp

Git + .NET = ❤
http://libgit2.github.com
MIT License
3.13k stars 879 forks source link

Add implementation for git_remote_default_branch #1969

Open mburtka opened 2 years ago

mburtka commented 2 years ago

Implements the feature requested in #1796

This fetches the default branch from a remote repository. This is useful to detect changes, and when remotes are added following initialization.

ghost commented 2 years ago

Hi @mburtka ,

May I suggest you to have a look at the similar functionality implemented in our fork and consider adopting (part of) it?

https://github.com/mendix/libgit2sharp/commit/d6e7723820cc4cd5c9abe006710c80a20d41fb9c

The difference is I believe that we've exposed the GetRemoteDefaultBranch as a static method on Repository class, so that the user could get a default branch name before they clone a repo.

atiq-cs commented 1 year ago

Is there any update on this?

Would love to set a default branch while initializing an empty repository. Thanks.