How to keep forked repositories updated

I'm currently trying to figure out how exactly the workflow for updating forked repository (i.e. sdk-zephyr) should look like ideally. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/dm_code_base.html#oss-repositories-downstream-project-history has some instructions in the end but I'm not quite sure how to interpret them.

Give I have previously:

  • forked the sdk-zephyr repository
  • git checkout ncs/v2.6.99-ncs1
  • git checkout -b "my-v2.6.99-branch"
  • made some changes, cherry-picked some fixes/features from zephyr upstream
  • git tag "my-v.2.6.99-release"

Now when NCS 1.8.0 is released, how do I correctly update my fork?

What I've done previously was something along these lines:

  • git checkout ncs/v2.7.0-ncs1
  • git checkout -b "my-v2.7.0-branch"
  • git checkout my-v2.6.99-release
  • git rebase --onto my-v2.7.0-branch v2.6.99-ncs1
  • resolve conflicts, skip empty commits (due to the previously backported commits now being part of the new release), etc
  • git tag my-v2.7.0-release

Which works okay-ish but feels somewhat hacky.

Ideally I'd of course like to just merge v2.7.0-ncs1 into my previous branch, but this leads to a lot of conflicts due to their histories diverging significantly.

The above documentation hints at there being a better way, utilising the v2.6.99-ncs1-snapshot/v2.7.0-ncs1-snapshot tags, but I don't quite understand what this would look like. Could you perhaps give an example?

Related