Fix a broken TEMPLATE branch
If you resolve merge conflicts through the GitHub web interface, the commit history from your dev branch merges into TEMPLATE. This causes problems in future template syncs because the updated TEMPLATE branch removes pipeline-specific files that were accidentally included. You may see over 100 files with conflicts during the next sync.
Identify a broken TEMPLATE branch
Check whether dev was accidentally merged into TEMPLATE:
- Review the number of commits in your
TEMPLATEbranch.
A healthy TEMPLATE branch typically has approximately 5-15 commits, depending on how many template updates your pipeline has received.
- Check your repository’s Network Graph under the Insights tab.
- Look through the
TEMPLATEbranch commit history for a commit message like ‘Merge branch ‘dev’ into TEMPLATE`’.
If you find evidence of this merge, rebuild your TEMPLATE branch from scratch:
Rebuild the TEMPLATE branch
-
Clone the main nf-core pipeline repository to your local machine (not your development fork):
git clone https://github.com/nf-core/<pipeline_name>.git cd <pipeline_name> -
Retrieve the commit hash from when the original nf-core template was used to generate the pipeline (that is, with
nf-core pipelines create). If you started with the nf-core template, check your git log:git checkout TEMPLATE git log --reverseThe first commit typically represents the original template, with a commit message like
initial template build from nf-core/tools, version 1.9. -
Reset the
TEMPLATEbranch to this commit:git reset --hard <commit_hash> -
Push the cleaned branch back to the repository:
git push origin TEMPLATE --forceWarningThis irreversibly overwrites git history. Verify you have the correct branch name before running this command.
-
Switch back to
devand run the sync command to get the latest template version:git checkout dev nf-core pipelines sync -
Delete your local copy of the pipeline that you cloned from the main nf-core repository.
-
Pull the fresh template branch into your personal fork:
cd <path_to_forked_pipeline> git branch -D TEMPLATE git remote add upstream git@github.com:nf-core/<pipeline_name>.git git fetch upstream TEMPLATE git checkout --track upstream/TEMPLATE git push --force
You can now recreate the pull request from TEMPLATE into dev. If conflicts occur, resolve them locally following the instructions in the sync documentation.