GNU/Linux Desktop Survival Guide
by Graham Williams |
|||||
Git Branch Migration |
20210121 With the change of the default naming of the core branch of a repository to main (by GitHub from 1 October 2020) users can rename their default branch from master to main. The steps are to backup the current repository in case of loss, create the main branch, push it to the repository, point HEAD to the new branch, connect to GitHub or BitBucket and under Settings/Branches or Advanced select Main as the default, then delete the original branch.
$ rsync -avzh ./ ../repo_backup_`date +%Y%m%d`/ $ git branch -m master main $ git push -u origin main $ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main Connect to GitHUb: Settings/Branches Branches/Main as default. $ git push origin --delete master |