Skip to content

Note that master is not always the default - #1729

Merged
ben merged 2 commits into
progit:mainfrom
noureddin:new-default-branch-name
Sep 14, 2022
Merged

Note that master is not always the default#1729
ben merged 2 commits into
progit:mainfrom
noureddin:new-default-branch-name

Conversation

@noureddin

Copy link
Copy Markdown
Contributor

Changes

  • Add an id to Ch01 > First-time Git Setup > Your default branch name.

  • Add a note in Ch02 > Recording Changes to the Repository > Checking the Status of Your Files, directly after the paragraph that says:

    Finally, the command tells you which branch you’re on and informs you that it has not diverged from the same branch on the server. For now, that branch is always master, which is the default; you won’t worry about it here.

    The note points out that remote repositories are likely to have a different default branch name.

Context

GitHub in mid-2020 changed the default branch name from master to main, and so did other Git hosts.
And many developers use an even different default branch name like dev or develop or something else.

A beginner might be very confused when seeing a repo whose default branch is not master. So I think it worth pointing out that explicitly.

I mean, the book asserts that the default branch is always master, when explaining the git status output in a freshly cloned repo. That repo is libgit2, whose default branch is main

A note that default branch name is likely different. A different branch
name would be very confusing to a beginner, especially when the book
asserts that the default is master.
@HonkingGoose

Copy link
Copy Markdown
Contributor

I found a related issue: #1462

GitHub and GitHub now create a main branch for you when you create a new repository from their interface.
I don't know when the Git program will make main the default branch when you run git init.

I guess when the book was written the libgit2 repo used master, and they migrated to main some time after the book was written. 😉

@ben ben left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ben
ben merged commit 3934272 into progit:main Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants