Best Practices for renaming `master` to `main` in pipelines
This guide shows you how to change your pipeline default branch from master to main.
Prerequisites
- Admin privileges for the GitHub repository where the change is taking place
- nf-core tools
Ensure that your version of nf-core/tools matches the pipeline’s template version by checking the .nf-core.yml file. This prevents introducing unrelated changes and keeps the update limited to switching the default branch from master to main.
Instructions
- Open your repository on GitHub. Make sure you’re viewing the masterbranch.
- Select Branches. It’s located to the right of the branch dropdown that shows master.

- In the Default branch section, find the masterbranch and select the More options (three-dot) menu, then select Rename branch.
You will need permissions to change this setting. If you don’t have permission, ask the @core-team for help on Slack.

- Rename mastertomain.
- Select the learn more, then copy the displayed instructions and save them somewhere safe.
These instructions will be useful for all pipeline contributors, so keep this to one side until the end of this tutorial!

- Select Rename branch.
- Select the Code tab and verify you are now on main.
- In your local IDE (e.g., VS Code), ensure you are on the devbranch.
- Run git fetch upstreamto ensure you have themainbranch locally.
- Run git config --global init.defaultBranch mainto change yourgitconfig tomain.
- Run git config --global init.defaultBranchto check yourgitconfig again, it should now reportmain.
- While still on dev, runnf-core pipelines sync.
- Run git switch -c default-branch-changeto switch to a new branch.
- Run git merge TEMPLATE.
If you don’t want any other template changes, make sure to use the nf-core/tools version that matches the template version in your pipeline.
- Resolve merge conflicts.
If it’s the ROcrate JSON file, you can accept all incoming change.
- Run a global repository search in your IDE to check that references of your pipelines masterare nowmain.
Make sure not to modify references of master in links to other repositories! If in doubt, ask on the nf-core Slack!
- Run nf-core pipelines lintto check you didn’t break anything.
- Run git add -am 'Change default branch'to commit and merge.
- Run git pushto push changes.
- On GitHub, make a new PR against dev.
- Review the PR to check all relevant links and the nextflow.configmanifest saymain.
- Request a community review on #request-review on Slack, and once you have an approval…
- … merge! 🎉
Post-change instructions
- 
Inform all your collaborators (on Slack, etc.) that the default branch has changed, and that they should update their clones and forks, i.e.: git branch -m master main git fetch origin git branch -u origin/main main git remote set-head origin -a
- 
Update your own clones and forks using the above commands.