DjangoGirls / tutorial

This is a tutorial we are using for Django Girls workshops
http://tutorial.djangogirls.org/
Other
1.53k stars 1.86k forks source link

Switch from master to main in tutorial #1676

Closed jwhitlock closed 2 years ago

jwhitlock commented 3 years ago

As of October 1, 2020, GitHub defaults to main as the the default branch for new projects. This means a few screenshots and instructions may be out of date.

Even though both main and master are English words, this change is being applied for all users, so it should affect all languages and operating systems.

In July 2020, git 2.2.8 introduced a new config item init.defaultBranch that could be used to sync the user's new repository to the GitHub default. Starting our Git repository could be updated to set this, and re-arranged to set all config before init:

$ git config --global --add init.defaultBranch main
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ git init
Initialized empty Git repository in ~/djangogirls/.git/

There are additional changes that would be needed. git status would now say you are on branch main instead of master, the push command would be git push -u origin main, etc. There would also be new screenshots, and there may be changes to the PythonAnywhere deploy.

This repository could also make the change from master to main, but I think that could be tracked as a separate issue.

ekohl commented 3 years ago

Not everything ships git 2.2.8 yet so you need to account for that. Just because Github changed its default, doesn't mean you need to follow it. I think that in terms of support you don't really need to do anything right now for the best result during workshops. AFAIK the current instructions still work.

nikhiljohn10 commented 3 years ago

Here is the current list of platforms and the git version they use or available for download or installation:

Platform Platform version / URL Git version
source https://github.com/git/git 2.29.2
download https://git-scm.com/downloads 2.29.2
windwos 2.29.2
brew 2.29.2
macport 2.29.2
mac-dmg https://sourceforge.net/projects/git-osx-installer/ 2.27.0
debian jessie 8 2.1.4
stretch 9 2.11.0
buster 10 2.20.1
bullseye 11 2.28.0
sid - developing 2.29.2
ubuntu xenial (16.04LTS) 2.7.4
bionic (18.04LTS) 2.17.0
focal (20.04LTS) 2.25.1
groovy (20.10LTS) 2.27.0
fedora Fedora 31 2.23.0
Fedora 32 2.26.2
Fedora 33 2.28.0
Fedora 34 2.29.2
archlinux 2.29.2
mx-linux 2.27.0
manjaro 2.25.1
das-g commented 3 years ago

More versions of Git in different distributions and package repositories can be found on repology. It doesn't look like assuming Git ≥ 2.2.8 would be problematic.

das-g commented 3 years ago

https://wiki.debian.org/LTS says

Debian LTS support for Debian 8 "Jessie" ended on June 30, 2020

so we I guess we can safely ignore what Git version Debian 8 "Jessie" provides.

das-g commented 3 years ago

In July 2020, git 2.2.8 introduced a new config item init.defaultBranch that could be used to sync the user's new repository to the GitHub default. Starting our Git repository could be updated to set this, and re-arranged to set all config before init:

More versions of Git in different distributions and package repositories can be found on repology. It doesn't look like assuming Git ≥ 2.2.8 would be problematic.

Hmm ... Though I've now noticed that the option was introduced in Git 2.28, not Git 2.2.8!

So we should probably wait till Git 2.28 is more widespread.

nikhiljohn10 commented 3 years ago

I guess we can revisit this topic when the following table update with version 2.28 in major distribution.

Packaging status

@das-g Thank you for the link to repology! Its very cool.

das-g commented 3 years ago

One way to switch to main as the default branch would be to simply rename it as suggested by GitHub on the page of a freshly-created, still empy repo:

image

git branch -M main

should work on all versions of Git still in use. And as (on the client-side) there's nothing special about the default branch, except that it's created initially, renaming it should really be all that's needed.

See also https://github.com/DjangoGirls/tutorial/pull/1585#discussion_r523420052

das-g commented 2 years ago

Related Pull Request: #1742

rgs258 commented 2 years ago

Related Pull Request: #1742

Guidance from #1676 has been applied to PR #1742