Is Git s "master" a branch name more than just a name?

I'm new to Git, and I wonder if Git's "master" branch is anything more than a name?
I would not have thought until I saw people, so as not to unite their main branch, but with the name "master".

Does it have any special features? Or is it as good as any other branch?
Of course, I look at the documentation, but the presence of a "leading" branch is always considered as given.

+7
source share
3 answers

This is the default branch name for the new repository and therefore, although not technically special, has a special status in most cases.

People often use it as a "stable" branch.

+2
source

This name refers to HEAD on the "default branch".
Note that after git init even this HEAD does not exist by default: you need to make at least one commit: see " Why do I need to explicitly push the new branch? ".

You can see the ' master ' used in very few commits of Git itself in commit cad88fd (Git 0.99, May 2005)

git-init-db : setting up a complete default environment

Create .git/refs/{heads,tags} and make .git/HEAD symbolic link (as yet nonexistent) .git/refs/heads/master .

His related tutorial at the indicated time:

One note: the special < master "head is the default branch , so the .git/HEAD file was created as a symlink, even if it does not already exist.
In principle, the HEAD link should always point to the branch that you are working on now, and you always start counting on working with the << 22> branch .

However, this is only a convention , and you can call your branches anything, and you don’t even need to have a " master " branch.
A number of Git tools will consider .git/HEAD valid.

+2
source

No, technically it's just a name.

However, the usual name of the central branch, to which the functions ready for release are combined, will work, and all work, as in subversion, the main branch is usually called trunk .

+1
source

Source: https://habr.com/ru/post/1200924/


All Articles