Renaming branches
Pipeline developers may choose to change the pipeline’s default branch from master to main for consistency with other repositories.
This guide demonstrates how to change a pipeline’s default branch from master to main.
You will need the following to get started:
- Admin privileges for the GitHub repository
- If you don’t have permission, ask
@core-teamfor help on Slack.
- If you don’t have permission, ask
- nf-core tools
Rename master to main
-
Open your repository on GitHub while viewing the
masterbranch -
Select Branches (located to the right of the branch dropdown menu)
-
In the Default branch section, find
master, select the three-dot menu, then choose Rename branch -
Rename
mastertomain -
Select learn more and save the displayed instructions for contributors
-
Select Rename branch to confirm
-
Verify you’re now on
mainin the Code tab -
In your IDE, switch to the
devbranch -
Run the following command to obtain the
mainbranch locally:git fetch upstream -
Configure Git to use
mainas the default branch name:git config --global init.defaultBranch main -
Verify the configuration:
git config --global init.defaultBranch -
While on
dev, run the sync command:nf-core pipelines sync -
Create a new branch for your changes:
git switch -c default-branch-change -
Merge the template changes:
git merge TEMPLATENoteEnsure your
nf-core/toolsversion matches the template version in your pipeline. -
Resolve any merge conflicts that appear
TipIf it’s the ROcrate JSON file, you can accept all incoming change.
-
Search your repository for references to
masterand update them tomainWarningMake sure not to modify references of master in links to other repositories!
If in doubt, ask on the nf-core Slack! :::
-
Run the linting tool to check for issues:
nf-core pipelines lint -
Commit your changes:
git add -am 'Change default branch' -
Push the changes to GitHub
-
Create a pull request against
devon GitHub -
Request community review on Slack
-
Merge the pull request upon approval
Update collaborator repositories
After merging the changes, notify your collaborators to update their clones and forks. They should run the following commands:
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -aYou should also update your own clones and forks using these commands.