Creating a bare git repository with specific default branch using Jgit

Viewed 233

From Git version 2.28.0, we can create a repository with specific default branch using

git init --initial-branch=trunk

I wanted to do the same with Jgit for bare repository but couldn't find the corresponding API either in Git.java or InitCommand.java .

Is this feature supported in Jgit ?

Thanks.

1 Answers

This is not supported/implemented by JGit at the moment (Q4 2020)

You can see the tests in InitCommandTest.java using the option --separate-git-dir, but none using --initial-branch.

Considering a git init --initial-branch=xxx does not leave any visible local configuration in the .git/config file, this is not a feature easily replicated at the repository creation step.

Related