Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let's change the name of the default branch to "main" #421

Closed
3 of 8 tasks
rouson opened this issue Apr 1, 2021 · 10 comments · Fixed by #565
Closed
3 of 8 tasks

Let's change the name of the default branch to "main" #421

rouson opened this issue Apr 1, 2021 · 10 comments · Fixed by #565
Assignees

Comments

@milancurcic
Copy link
Member

👍 from me.

@awvwgk
Copy link
Member

awvwgk commented Apr 1, 2021

From a technical point of view an organisation owner of @fortran-lang or a member with administrator access scope can make the default branch rename at https://github.com/fortran-lang/fpm/settings/branches. Usually additional migrations are required:

  • we have a workflow where the name of the default branch is hard coded
    if: github.event_name == 'push' && github.repository == 'fortran-lang/fpm' && ( startsWith( github.ref, 'refs/tags/' ) || github.ref == 'refs/heads/master' )
  • we are referencing the default branch name in the fpm help page, documentation and contributing guide lines
  • search below for master in this project, lot's of false positives, but some fpm related links are present:
❯ rg master .
./PACKAGING.md
649:`helloff = { git = "https://gitlab.com/everythingfunctional/helloff.git", branch = "master" }`,

./CONTRIBUTING.md
12:[fpm license](https://github.com/fortran-lang/fpm/blob/master/LICENSE).
24:[Fortran stdlib style guide](https://github.com/fortran-lang/stdlib/blob/master/STYLE_GUIDE.md)
38:   Try to reproduce it with the latest version from the master branch.
112:  [Fortran stdlib style guide](https://github.com/fortran-lang/stdlib/blob/master/STYLE_GUIDE.md).

./docs.md
5:project_download: https://github.com/fortran-lang/fpm/archive/master.zip

./src/fpm_command_line.f90
715:    '   https://github.com/fortran-lang/fpm/blob/master/manifest-reference.md        ', &

./src/fpm/cmd/new.f90
136:        &'  #     https://github.com/fortran-lang/fpm/blob/master/manifest-reference.md   ',&
138:        &'  #     https://github.com/fortran-lang/fpm/blob/master/PACKAGING.md            ',&
350:        &'  # like. By default the latest master master branch is used. You can           ',&
357:        &'#stdlib = {git="https://github.com/LKedward/stdlib-fpm.git",branch = "master" },',&

./manifest-reference.md
406:toml-f = { git = "https://github.com/toml-f/toml-f", branch = "master" }
  • other @fortran-lang projects might also reference files in the fpm repo

@awvwgk
Copy link
Member

awvwgk commented Apr 1, 2021

I'm all for migrating the default branch name, but I don't think it makes much sense unless it happens for all @fortran-lang repositories.

@milancurcic
Copy link
Member

I'm all for migrating the default branch name, but I don't think it makes much sense unless it happens for all @fortran-lang repositories.

We should do it for all repos but it doesn't need to happen all at once.

For the transition, instead of renaming "master" -> "main" in the settings, do you think this flow would work:

  1. Create a branch "main" from "master"
  2. Do necessary PRs for docs and CI to work with "main"
  3. Change default branch in settings from "master" to "main"
  4. Delete "master" branch.

@rouson
Copy link
Contributor Author

rouson commented Apr 4, 2021

@milancurcic the workflow you outlined is what I've done on other repositories where I've made this change.

@awvwgk
Copy link
Member

awvwgk commented Sep 8, 2021

For the transition, instead of renaming "master" -> "main" in the settings, do you think this flow would work:

  1. Create a branch "main" from "master"
  2. Do necessary PRs for docs and CI to work with "main"
  3. Change default branch in settings from "master" to "main"
  4. Delete "master" branch.

It seems that GitHub is offering a somewhat more seamless way of renaming branches, which will automatically create a redirect from "master" to the new branch name. This only leaves step 2 as a follow-up to the renaming, everything else will be automatic.

I'm happy to start with doing the necessary changes for fpm and we can evaluate how this strategy works out in practice before taking on the other repositories.

@jvdp1
Copy link
Member

jvdp1 commented Sep 8, 2021

fine for me!

@milancurcic
Copy link
Member

@awvwgk Wonderful, I didn't know about it. Sounds like the way to go.

@awvwgk
Copy link
Member

awvwgk commented Sep 8, 2021

Just did the renaming, let me know if it works as expected.

@awvwgk
Copy link
Member

awvwgk commented Sep 8, 2021

Here is what I did to update my local git repository (I'm using github as identifier for this repo, upstream is my fork):

❯ git checkout master
Switched to branch 'master'
Your branch is up to date with 'github/master'.
❯ git branch -m master main
❯ git fetch --all --prune
Fetching upstream
From github.com:awvwgk/fortran-package-manager
 - [deleted]           (none)     -> upstream/master
   (refs/remotes/upstream/HEAD has become dangling)
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 13 (delta 6), reused 7 (delta 3), pack-reused 0
Unpacking objects: 100% (13/13), 3.37 KiB | 313.00 KiB/s, done.
 * [new branch]        main       -> upstream/main
Fetching github
From github.com:fortran-lang/fpm
 - [deleted]           (none)     -> github/master
remote: Enumerating objects: 690, done.
remote: Counting objects: 100% (690/690), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 484 (delta 464), reused 482 (delta 462), pack-reused 0
Receiving objects: 100% (484/484), 82.67 KiB | 1.02 MiB/s, done.
Resolving deltas: 100% (464/464), completed with 197 local objects.
   86ec00b6..0a9d845e  gh-pages   -> github/gh-pages
 * [new branch]        main       -> github/main
❯ git branch --set-upstream-to github/main
Branch 'main' set up to track remote branch 'main' from 'github'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants