Setting up a pipeline sync retrospectively
Use this guide to set up a correct TEMPLATE branch for pipelines that were not created with nf-core pipelines create.
If you created your pipeline with nf-core pipelines create, your TEMPLATE branch is already configured correctly.
Before proceeding, push all local changes to GitHub and consider making a backup clone of your repository.
Alternatively, consider restarting your pipeline project by running nf-core pipelines create and copying your modifications into the newly created pipeline.
This guide assumes you are working directly with the main nf-core repository. You can also work on your own fork.
Create the TEMPLATE branch
-
Clone your pipeline into a new directory:
mkdir <temp-directory>cd <temp-directory>git clone https://github.com/nf-core/<pipeline-name>.gitcd <pipeline-name> -
Create the new
TEMPLATEbranch and delete all files to create a completely empty branch:git checkout --orphan TEMPLATE && git rm -rf '*' -
Verify your branch is completely empty:
git statusYou should see:
Terminal window On branch TEMPLATENo commits yetnothing to commit (create/copy files and use "git add" to track) -
Regenerate your pipeline from scratch using the most recent template:
nf-core pipelines create --no-gitIf your pipeline already has versioned releases (for example, you are not currently on
1.0dev), specify the version number:nf-core pipelines create --no-git --version 1.3devNoteThe version you choose should match the branch you intend to merge with. If you already have a release, use the version number specified in your
devbranch. -
Follow the prompts to enter the pipeline name, description, and authors. Use the exact text from your existing
nextflow.configfile (manifest.nameetc.). -
Move the newly created template files into your root git directory:
mv nf-core-<pipeline-name>/* .mv nf-core-<pipeline-name>/.[!.]* .rmdir nf-core-<pipeline-name> -
Verify the newly created files are in the correct place:
git statusYou should see output similar to:
Terminal window On branch TEMPLATENo commits yetUntracked files:(use "git add <file>..." to include in what will be committed).editorconfig.gitattributes.github/.gitignore.markdownlint.ymlCHANGELOG.mdCITATIONS.mdCODE_OF_CONDUCT.mdLICENSEREADME.mdassets/bin/conf/docs/lib/main.nfmodules.jsonmodules/nextflow.confignextflow_schema.jsonsubworkflows/workflows/nothing added to commit but untracked files present (use "git add" to track) -
Commit the template files:
git add .git commit -m "Initial template commit" -
Push the
TEMPLATEbranch to the upstream nf-core repository:git push --set-upstream origin TEMPLATE
Merge TEMPLATE into main branches
Merge the TEMPLATE branch into your main pipeline branches.
This requires manually resolving all merge conflicts.
-
Check out your development branch and create a new branch for the merge:
git checkout devgit checkout -b template_merge -
Merge the
TEMPLATEbranch:git merge TEMPLATE --allow-unrelated-historiesNoteIf the merge command shows entire files as new, try adding the
-Xignore-space-at-eolflag. -
Resolve merge conflicts. You may see many conflicts:
Terminal window Auto-merging nextflow.configCONFLICT (add/add): Merge conflict in nextflow.configAuto-merging main.nfCONFLICT (add/add): Merge conflict in main.nfAuto-merging environment.ymlCONFLICT (add/add): Merge conflict in environment.ymlAuto-merging docs/usage.mdCONFLICT (add/add): Merge conflict in docs/usage.mdGo through each file to resolve the merge conflicts. Use a visual merge tool to avoid mistakes when handling many merge markers.
-
Commit and push the resolved changes:
git commit -m "Merged vanilla TEMPLATE branch into main pipeline"git push origin template_merge -
Create a pull request from your
template_mergebranch to the main nf-core repository. -
Once merged into the
devbranch, future automatic template syncs will work correctly. When nf-core releases new versions ofnf-core/tools, pull requests will automatically be created to merge updates into your pipeline.