progit2 icon indicating copy to clipboard operation
progit2 copied to clipboard

Note that master is not always the default

Open noureddin opened this issue 3 years ago • 1 comments

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

noureddin avatar Feb 06 '22 17:02 noureddin

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. 😉

HonkingGoose avatar Mar 30 '22 14:03 HonkingGoose