NatLibFi / Annif

Annif is a multi-algorithm automated subject indexing tool for libraries, archives and museums.
https://annif.org
Other
195 stars 41 forks source link

Switch default git branch to main #679

Closed juhoinkinen closed 1 year ago

juhoinkinen commented 1 year ago

Nowdays the default branch of a new GitHub repository is named main instead of master, and many existing projects have renamed the default branch to main.

According to GitHub documentation the basic rename process should be quite straightforward. When a branch (master) is renamed in the GitHub web UI, automation re-targets all open PRs, sets up URL redirects etc..

However, the default branch can also be changed to an existing branch. This gives the opportunity to cleanly get rid of the two erroneously pushed commits (this and this) to master and their reverts by first branching the main from master at the point before the erroneous commits. Apparently changing the default branch does not automatically retarget PRs and do other changes what renaming would do.

But as @osma suggested, lets do the rename, and just drop the erroneous commits before.

Steps:

juhoinkinen commented 1 year ago

I did locally

git reset --hard eb437a820c7140568d0d6f4fcc434925d5fe5316
git log  # double checking the reset was to correct commit
git push --force-with-lease  # before needed to switch off branch protection of master

Then renamed the default branch to main in GitHub UI, and I was shown the commands to update local clones:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
juhoinkinen commented 1 year ago

References to master updated in #680. In Wiki the master -> main redirection in links works, so there is no need updates in there.

So everything else should be working as previously, but CodeBeat analysis got confused: the checks show image

and I cannot find a way to change the target branch in CodeBeat project/account, I think I don't have the permissions for that.

osma commented 1 year ago

I had to recreate the NatLibFi/Annif project in Codebeat and delete the old one, as it wasn't possible to change the branch directly. I changed the badge in https://github.com/NatLibFi/Annif/commit/3d44c00e5172ffc1143c71131da461d0f5ea4142 so it refers to the new project.

juhoinkinen commented 1 year ago

Osma changed the branch also for the Scrutinizer analysis, so now (again) everything for this seems to be done, I close this.

juhoinkinen commented 1 year ago

Still one update was needed: the "latest" version of ReadTheDocs documetation was no following the new main branch before I switched the default branch (in Advanced Setttings) from ------ to main.