Closed BJWiley233 closed 3 years ago
I believe this has not yet been enacted in libgit2 but that is coming:
https://github.com/libgit2/libgit2/issues/5562
So gert gets this feature when libgit2 gets the feature.
Ok thanks. Had a feeling about that. Do we have to read through that mailing list to see what the status is?
The git mailing list? No, because the feature is already present in command line git.
So if you want to stay current re: libgit2 (and gert), I'd subscribe to the issue linked above.
(FYI: command line git and libgit2 are 2 entirely separate code bases, believe it or not.)
I now know that this has been implemented in libgit2 as of v1.1 "Fernweh":
- The
init.defaultBranch
setting is now respected andmaster
is no longer the hardcoded as the default branch name.
and I have personally verified the behaviour from R (so doing git init
via gert, via usethis). The libgit2 issue linked above should actually be closed and presumably will be soon.
Furthermore, the version of libgit2 that comes with the CRAN version of gert as of v1.0.2 -- at least for macOS and Windows users -- is sufficient to honour init.defaultBranch
.
So I'm going to close this. The answer for macOS or Windows users is simply to re-install gert from CRAN.
Part of why I remained confused about this for so long is that libgit2 v1.1 took a long time to make its way into homebrew (happened here https://github.com/Homebrew/homebrew-core/pull/65706) and I am often installed from a locally built version of gert. But this is also resolved as of early December.
This is more of a question but I set my .gitconfig so
defaultBranch = main
but when I run git_init() inside my .Rproj it seems to still create a 'master' branch. Is there an easy way to fix this? If I run git init for my other projects it defaults the HEAD toref: refs/heads/main
. How to do this for gert?