Xcode 12.0 beta (12A6159) switched initial git branch name: master
to
main
. Is there a way how to switch it back or to any other branch name?
DVTSourceControl.framework
is responsible for this. The framework is located
in the Xcode-beta.app
bundle (Contents/SharedFrameworks
). Call
Hopper for help :)
Is there a main
string anywhere?
We’re lucky. It’s there and the string is referenced in one place only:
And this place is the +[DVTSourceControlBranch initialBranchName]
class method:
The method name is pretty clear, but what it does? Is there a string value stored in user defaults
(key DVTSourceControlDefaultNewRepositoryBranchName
)? Yes - use it as an initial branch name.
No - fallback to main
.
Git support is provided via the com.apple.dt.Xcode.sourcecontrol.Git
XPC service (bundled in
the framework). Let’s try to set the voldemort
value in this domain.
% defaults write com.apple.dt.Xcode.sourcecontrol.Git \
DVTSourceControlDefaultNewRepositoryBranchName voldemort
Create a new Xcode project and keep the Create Git repository on my Mac option enabled.
Does it work?
% git status
On branch voldemort
Yep! You can easily switch it back to master
or any other branch name.