progit / progit2

Pro Git 2nd Edition
Other
5.77k stars 1.9k forks source link

Note that master is not always the default #1729

Closed noureddin closed 1 year ago

noureddin commented 2 years ago

Changes

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

HonkingGoose commented 2 years ago

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