0

I have a repository, which is a fork of a public project. The fork contains several additional commits with custom features - nothing fancy. Recently, I have been wondering what would be the best approach of incorporating upstream changes into the fork. Currently the setup looks like the following:

  1. The fork has the master branch with these additional commits and another branch that acts like a staging branch (let's call it staging).
  2. Every now and then I check if anything new has been released in the upstream repository.
  3. If yes, then I rebase staging first (staging also contains all these additional commits). This results in a GitLab pipeline which builds a Docker image and pushes it to a Docker repo with staging tag. After that, a k8s deployment is restarted and the new changes are available in the staging environment.
  4. If everything is fine, I repeat the same process but this time I rebase fork's master against upstream master (sometimes I simply reset --hard master to staging).

I feel like the whole process needs a bit of improvement. I was thinking about using custom tags in my fork, but these would be kind of "lost" with every rebase.

4
  • 4
    This is a textbook case for using "merge" instead of "rebase".
    – pjc50
    Apr 20 at 11:13
  • Supporting @pjc50's observation; is there any reason you're choosing to rebase? Do you have a need to somehow interleave the commits of your code and that of the original repo?
    – Flater
    Apr 20 at 11:16
  • I like having my git history clean thus I have decided to use the rebase workflow. It feels to me that using merge workflow in that case would complicate things a bit. The thing is that I add new commits very sporadically to my fork and they are always on top of the branch - that is what seemed to be the simplest and cleanest solution for me.
    – mic4ael
    Apr 20 at 12:26
  • I've honestly never heard of anyone using anything other than merge for this purpose...
    – albert
    Apr 20 at 13:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.