Hi all, I have a template/git-history/merge questi...
# tools
n
Hi all, I have a template/git-history/merge question. Hope this is the right place: afaik general nf-core merge policy is to squash&merge. does that also apply for template update PRs? I often had the issue that template updates (for example merging upstream/TEMPLATE into template-update-x) would pick the initial repo commit as merge base:
Copy code
$ git merge-base upstream/TEMPLATE template-update-x
<initial commit of repo>
So the changes from the previous template updates would potentially have to be redone (resulting in a lot more merge conflicts) I think using the squash&merge policy for template updates results in a loss of the nf-core-bot commit hashes. When git then tries to find the last common ancestor of
upstream/TEMPLATE
and
template-update-x
, it has to walk all the way to the inital commit. Am I correct, that we would want git to pick the most recently merged template update (nf-core-bot commit) as merge-base? to give a visual example: commit D3 adds changes from T2, but due to squashing, it is not reflected in the git history. If I now want to add changes from T3 into template-update-x, git would pick
init
as merge base. but we want
T2
as merge base?
Copy code
init------T1--------T2-----T3                 (TEMPLATE)
   \
    \-----D1---D2--D3(incorporates T2)---D4   (dev, template-update-x)
If so, I have only found two approaches: 1. use regular merge for template updates to preserve nf-core-bot commit hashes in git history (linking D3 to T2) 2. add a pseudo-merge with the most recently integrated template update commit (the desired merge-base) with
--strategy ours
to change nothing, but add the commit to the git history what would be the nf-core-way? it feels a bit like I am missing the straight forward way, but could not find anything in the docs or slack.
m
yes, for template updates, don't squash merge.
👍 1
👌 1
p
@mashehu is this something that we could put into repo rulesets?
m
only as a general rule, for all PRs targeting
dev
afaik
👍🏻 1
even worse. only on a repo level it looks like
sadpanda 1
correction, it is just a bit hidden, but can be done per branch, but only target branch not source branch
👍🏻 1
n
thanks for the quick response! the docs state to "merge as usual" should we maybe rephrase this, as the "usual" nf-core way would be squash-merging?
m
yes, good idea. feel free to make a PR (there is an edit button on the top right)
👍 2
p
Squash merging in nf-core is relatively new, so these docs probably predate it
there is an edit button on the top right
Almost none of these work now, been meaning to have a look into fixing them
m
have you tried recently? I think I found a fix for most of them.
f
wait just to get it correct: squash & merge for all PRs to dev, except for template updates, no squash & merge for releases
m
yes, just to be clear: allow squash & merge for all PRs to dev. people are free to do whatever they prefer there