[SOLVED] How to assign an issue on github to me? How to merge / rebase to upstream

There is an issue related to the Nanoleaf binding that I am maintaining. I would like to assign it to me but somehow I can’t. Do I have to be added to the project, so that I can assign it to me?

Here is the issue I am talking about:

TIA
Stefan

What is your github handle ???

This is me: stefan-hoehn · GitHub

Assigned

1 Like

Thanks, and is there a way I can do it myself and set it to “in progress”?

Normaly, just click on assignees and then add your github handle.
You might also add a label “work in progress”…

Neither I can click on assignees nor on labels.

I haven’t been added to " [CODEOWNERS]" yet. Is that one of the reasons?

Sorry, but don’t know, as I am no maintainer for addons repo.

Anyway, thanks for your help so far, Hans-Jörg.

Yes that is part of the reason. If you think you should be added as code owner, add your github name to the CODEOWNERS file and create a pull request.

Yes, Hilbrand, that makes sense. I will do that alongside with my upcoming changes in a few days and then let you know here or will someone automatically be triggered if something changes in that file? (Well, basically, the pull request is reviewed anyway, so I am sure you guys will notice :slight_smile: )

I finally pushed something new to my repo: GitHub - stefan-hoehn/openhab-addons: Add-ons for openHAB
and “of course” it says “This branch is 1 commit ahead, 90 commits behind openhab:main.”

Can you (again) advice how I can merge the changes from openhab:main to my fork to make sure it doesn’t conflict when I finally do a pull request?
(Either locally or through github - I don´t mind)

thanks
Stefan

PS: I tried a few things like “git pull upstream” and so forth but these all didn’t work. I apologize for being always so helpless with for forks and remote repos… :cry:

You can do a ‘rebase’ which will take all of the commits from openhab:mail and than add your commit(s) on top of that.

After the rebase yo’ll need to push with force box selected (in UI) or prob something like --force if done on the command line

Marcel, would you mind being more specific what command I should do locally or on GitHub in detail?
Tia
Stefan

This is indeed local.
I don’t know how you develop, but in eclipse the steps are like this

go to the git perspective
go to the remotes in the git repository list
Select the origin and click fetch to get the latest and greatest

Than select the origin/main branch and right click. In the menu select rebase

I am using intellij.

I can select the remote like so:


The “problem” I see here is that this refers to my own(!) repo which is a fork from the main openhab repo as I must not develop against the main repo. Hence, what I am missing is how I can pull the latest changes from the remote repo into my forked one.

With the help of a colleague who is a git guru (Thanks Basti) :slight_smile: 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” :wink: 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

3 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.