GitHub Commit Question

github

#1

Searched up and down but can’t find my answer.

I’ve done a bunch of coding in my IDE but up to now I’ve never committed anything. I am now trying to commit but have some questions.

I have GitHub integration on and have set up my fork, etc. When I come to commit my code I can’t figure out how to send to the right repository as so many use the same name (thanks to the ST doc for that). Here’s my point. I have the following set up in integration:

When I hit Commit I get the following list:

I thought perhaps things were in the same order as the settings list (as they are when you ‘update from repo’) but it seems not as I tried a commit yesterday and I’m pretty sure it went to the wrong place! How on earth do I commit to my repository?

I am sure my post shows I’m a novice here.


Creating a Github from scratch AND uploading code I have in a file
#2

No one? I know we have a ton of developers in here. What am I doing wrong or what is it I’m not getting?

Appreciate any pointers anyone has please.

Thanks


(Raj Karamchedu) #3

@Nezmo Hey, sorry you didn’t get response sooner. You probably have looked at this doc? https://github.com/SmartThingsCommunity/Documentation/blob/master/README.md

Before even getting to the “git commit…” did you do “git checkout -b origin/master”?

Git commits are local. In other words, your commits go into your local branch that you created with the above command, with the name (whatever your branch name is).

Does the above comment help?


#4

I have followed some ST doc but I had not seen the doc you just linked to. I’ll take a look. At first glance it would seem I have missed a step.

I’ll post back if I more issues, thanks.


(PPO16) #5

Personally, I don’t fork the SmartThings GitHub to add my stuff, I use my own GitHub and provide my repository and branches identifiers to the ST community.


#6

At this point, all I want to do is put code I have in my IDE in to GitHub so I can share that with everyone. Is it really as crude as copying and pasting from your IDE to a file then uploading that file manually to your own GitHub?

I know it has to be easier than I’m making this. I just can’t find clear information on what the steps are. Right now I have a modified handler in my IDE that I’d like to share. I can’t simply paste the code in to a post as it’s too big. How do I share this using GitHub?


(PPO16) #7

You just have to:

  1. create a repository on your github and if needed define a branch name.
  2. In your ST IDE settings, setup you github name, repository and branch
  3. Then in ST IDE, edit your file, edit the dth property to .it with the repository.
  4. Go back to the devicehandler page and click commit button, choose your repository and validate
  5. click on the files from the IDE you want to push
  6. if everything is done, the dth line will turn black

#8

Okay, I believe I have done all of this but the one part I’m having trouble with is in bold. I actually managed to do this previously but I ended up sending it to the wrong repository as I can’t tell from the list given which is mine. That was what I was trying to show in my first post - how do I know which is mine in the list of repositories shown after hitting ‘commit’ when several have the same name.

Thanks for your patience.


(PPO16) #9

Here you go:

App Setting (for a smartapp): you set your repository
5a293c94eb2b7b6d3b21a6e9d782c43f8a025b88_1_690x175

For a deviceHandler: same but in Device Handler Settings:

Then: commit


If anything is changed in your IDE versus your GitHub repo, you will see the file listed there: notch it, add a commit comment and done


#10

Okay, so here’s where I have my repository set in my device handler:

And when I hit commit I get this list which is all the repositories I’m connected to as well as mine. As happens, there are many with the same name. My issue is how do I know which one to choose? It’s this step I am trying to figure out. I tried the first in the list that matched my name and it got committed to someone else’s repo.


(PPO16) #11

That’s why I was suggesting you to use your own repository so you don’t have ambiguity.
Now one thing I am surprised is that you would work on the Master branch of SmartThingsPublic. I would expect you are on your own branch.

Maybe I am missing something here but if several owners touched the same code, by having so many ST(Master) references, you will end-up in a mess when you refresh your code: how to know which one you have to use.


#12

And that’s probably where I am going wrong. Maybe I have a disconnect in my understanding. I have this set-up in GitHub:

19%20AM

And in the ST IDE I enabled GitHub and set-up the following:

I just create new handers in the IDE. I assumed those sat on my fork? Obviously I don’t understand things fully.

It seems many people have used the same master names as that was implied in some ST doc.


(PPO16) #13

yes the commit should push the code at your master of your forked setup. But imagine you touched module Switch and another guy you import in your IDE also modified it, whcih one you take?

I would personally import in my forked setup all thr contributions I want to use.
That might require maintenance effort ro report others updates but that wpuld be the clearest to me.

Not sure I am being helpful now…


(John) #14

So basically you’ve figured out that ST’s implementation of the “Update from repo” list is terrible. None of us can change it. What Philippe is trying to convey is that you can influence how your github entry shows up by doing one, two, or both of the following:

  1. Change your github repository name to something other than SmartThingsPublic to something that’s unique
  2. Change your branch to something that’s unique

Once you change either or both you’ll need to update your entry in the repository list. Then your repository will be easily visible (depending on the uniqueness of the names you changed them to)…

Also complain to ST that the feature is difficult to use in it’s current state. Honestly this should be easily fixable for them by just including the repository owner’s name in the list when clicking “Update from repo”.


#15

I had come to this realization after all the help.

No kidding.

Thank you both.

UPDATE: I renamed by repo and it looks like I’m in business. Thanks again @Philippe_Portes and @shadowjig.


(Borristhecat) #16

I don’t know how @ady624 does it but everything he puts out, has its own name and makes it a piece of cake to update from repo. Wish they were all like that, then I wouldn’t have to try 5 different ones before I find the correct one. :smile:


(Joel W) #17

I have become so pissed at the way update from repo shows, that I have resorted to printing out a screen shot and numbering them. Still have to open update and count down to the one I want. Would be nice if the format was numbered.


(John) #18

My experience has been that the settings and update screens are not in the same order. Furthermore, I don’t have delete options for ALL the repository I’ve added. Poor UI experience in my opinion.


(Joel W) #19

Poor experience to say the least, but mine are all in order.


#20

As are mine for doing an ‘Update from Repo’ but they are not in order when doing a ‘Commit’ thus the primary reason for me starting this thread. Once I uniquely named my repo then the lack of order issue was no longer a problem.

But yes, it’s a mess.