With the help of a colleague who is a git guru (Thanks Basti)
I was able to master it. So let me explain what has to be done which might be help to others as well.
First I committed my changes and pushed it to MY repo which leads to differences between the main repo (which is usually called upstream by convention). Don’t forget “–signoff” (like I did).
git commit -m "[nanoleaf] CODEOWNERs, add Shapes Support, beta-firmware support, less noisy" --signoff
git push
With the next the command you can see which remote branches you have which in my case (of course this only revealed connections to my github repository as I have no link to the main repo)
git remote -v
Now I need to add the main repo as mentioned with the name upstream (by convention). If you want you can do another “git remote -v” to verify it.
git remote add upstream https://github.com/openhab/openhab-addons.git
Next up is to retrieve all information of the upstream repo (note that it only fetches the information to the local but does not apply those to the branch you are currently on)
git fetch upstream
Just to be absolutely sure we are on the right branch locally, we move there (most likely you are already there any way)
git checkout main
This is where the actually magic begins. With “git rebase” git uses all commits that happened in the meantime since the last time when I retrieved code from the original repo and “cherry picks” those as if I would have started my changes not a few days ago but on top of these commits. This makes the final git tree much cleaner. Note that this will open an editor (be warned not unlikely “vi” as editor will appear which you can exit with !wq)
git rebase -i upstream/main
Now let’s check our status (which is fine) and try to push to our own remote repo which will fail because the local repo and the remote repo have diverged in a way that it would be too dangerous to just allow that.
1079 git status
1080 git push
but because we know what we do (since today) we have use the “force”
to convince git to allow it.
1081 git push --force
Now my remote repo is only 1 commit ahead from the upstream and I am ready to do a “pull request” to the main repo.
Enjoy git…
Stefan