Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork937
How to know which is the default branch#1364
-
How one can one which is the default branch? main/master? One can know about this by iterating all heads and then manually check , but that is also have one issue. How to get the default branch ? |
BetaWas this translation helpful?Give feedback.
All reactions
this seems to workrepo.remotes.origin.refs.HEAD.ref.remote_head
bit verbose tho!
Replies: 3 comments 5 replies
-
The default branch is only relevant once, when initializing the repository and git has to decide how to name the only branch in the repository. From there the only questions that can be answered are…
|
BetaWas this translation helpful?Give feedback.
All reactions
-
Is there any way to know the default_branch of repository? |
BetaWas this translation helpful?Give feedback.
All reactions
-
There is a way to ask for configuration values, search for 'config'here. From there it's, it's usingthe right configuration key to get or set the value. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I did |
BetaWas this translation helpful?Give feedback.
All reactions
-
Keep debugging and I am sure it will be possible to read config values from it. If that's not the case and reproducible please file an issue. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Can we rely upon
Will it give the main branch of the repo (main/master or any branch which is main of the repo) |
BetaWas this translation helpful?Give feedback.
All reactions
-
this seems to work bit verbose tho! |
BetaWas this translation helpful?Give feedback.
All reactions
-
This doesn't work when |
BetaWas this translation helpful?Give feedback.