You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I work on an empty repo that may have been created with git init (and thus it's .git/HEAD contains ref: refs/heads/master.
Now I want to write some commit but to a branch other than the default branch master.
I had kinda hoped that I could simply use repo.set_head("refs/heads/mybranch") and when I then repo.create_commit("HEAD",... it would use that.
But set_head already fails when the branch doesn't exist yet.
From what I could see from the sources, set_head uses libgit2’s git_repository_set_head() and that indeed seems to be documented as being usable with unborn branches:
If the provided reference points to a branch, the HEAD will point to that branch, staying attached, or become attached if it isn't yet. If the branch doesn't exist yet, no error will be return. The HEAD will then be attached to an unborn branch.
Any way to get that with pygit2?
Thanks,
Chris.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Hey.
I work on an empty repo that may have been created with
git init
(and thus it's.git/HEAD
containsref: refs/heads/master
.Now I want to write some commit but to a branch other than the default branch
master
.I had kinda hoped that I could simply use
repo.set_head("refs/heads/mybranch")
and when I thenrepo.create_commit("HEAD",...
it would use that.But
set_head
already fails when the branch doesn't exist yet.From what I could see from the sources,
set_head
uses libgit2’s git_repository_set_head() and that indeed seems to be documented as being usable with unborn branches:Any way to get that with pygit2?
Thanks,
Chris.
The text was updated successfully, but these errors were encountered: