fritzing / fritzing-parts

Electronic components for use in the Fritzing app (aka the parts library)
http://fritzing.org/parts
Other
510 stars 359 forks source link

add Arduino sensor shield V5, gear-motor, ky_006, shaft-encoder, yl99 parts #221

Closed vanepp closed 5 years ago

vanepp commented 5 years ago

I seem to be behind the master again, and this won't automatically merge. This adds the above five parts to core. I loaded the local parts repository in to Fritzing, regenerated the database and checked the parts all load correctly.

KjellMorgenstern commented 5 years ago

The conflict is because the FIRST parts on your branch have different icons (I compressed the svg icon files during the pull request). There are many ways to recover, one would be to reset your feature branch to origin/develop, then cherry-pick 37cd8f9. Command line looks like this

# first make sure we are in sync
git fetch --all
# save uncommited changes, just to be save
git stash

A short command to resolve the conflict: git rebase --onto origin/develop develop~1 develop This says: take my last commit from the branch 'develop', append it to origin/develop, and then set 'develop' to point there. After this is done, you can push (using force) the new develop branch to github, and this pull-request will be updated.

Or a long way, maybe easier to understand, split in single steps:

# go to your develop branch
git checkout develop
# create 'temp' 
git checkout -b temp
# go back from temp to develop
git checkout develop
# set your develop branch to the official one from github
git reset --hard origin/develop
# now the cherry picking
git cherry-pick temp
# finished, check that all is ok and push to github/vanepp/fritzing-parts. Force will be needed.
git push --force

This is blind flight, as I don't know your local files structure. It's always a good idea to check that you don't have any uncommited changes (and stash or commit them) before doing such things.

vanepp commented 5 years ago

I'm doing this from the cygwin command line in Win7 with a locally cloned version of my Fritzing-parts repository on github. I think the part I have been missing is the git fetch --all, I have tried git pull but that usually tells me I am up to date (I think with my fork on github which makes sense). The last time I synced my repo to the master I did it via the github web page with a trick from stackoverflow (I think the usual way is via a git client running on the local machine, although I haven't seen an example of that either.) and that seemed to work. I forgot to do that this time, but if the git fetch --all works (as it seemed to) then that is probably the correct way to do this. If I can figure out a procedure that works I'll write it up and post it to the forums as a howto as I think this is what is stopping a lot of folks from submitting parts. Here is a log from my local machine from the cygwin command line:

cd /cygdrive/d/repos/fritzing-parts

git fetch --all

Fetching origin Fetching upstream From https://github.com/vanepp/fritzing-parts

$git stash (shouldn't do anything as there are no uncommited changes.)

No local changes to save

$ git rebase --onto origin/develop develop~1 develop First, rewinding head to replay your work on top of it... Fast-forwarded develop to origin/develop.

$ git push -f Username for 'https://github.com': Password for 'https://vanepp@github.com': Everything up-to-date

The changes appear to be in the local repo:

$ ls /cygdrive/d/repos/fritzing-parts/core/Sensor-Shield-v5_1.fzp /cygdrive/d/repos/fritzing-parts/core/Sensor-Shield-v5_1.fzp

$ ls /cygdrive/d/repos/fritzing-parts/svg/core/breadboard/Sensor-Shield-v5_1_breadboard.svg /cygdrive/d/repos/fritzing-parts/svg/core/breadboard/Sensor-Shield-v5_1_breadboard.svg

ls /cygdrive/d/repos/fritzing-parts/svg/core/icon/Sensor-Shield-v5_1_icon.svg /cygdrive/d/repos/fritzing-parts/svg/core/icon/Sensor-Shield-v5_1_icon.svg

ls /cygdrive/d/repos/fritzing-parts/svg/core/pcb/Sensor-Shield-v5_1_pcb.svg /cygdrive/d/repos/fritzing-parts/svg/core/pcb/Sensor-Shield-v5_1_pcb.svg

ls ls /cygdrive/d/repos/fritzing-parts/svg/core/schematic/Sensor-Shield-v5_1_schematic.svg /cygdrive/d/repos/fritzing-parts/svg/core/schematic/Sensor-Shield-v5_1_schematic.svg

but somehow it doesn't seem to have pushed the changes as it should both from the upto date message from the push and that nothing has changed in the pull request. As well my repo on github is still unhappy, so I think the git fetch -all may not have worked somehow my forked repo shows the same message as it did last night:

https://github.com/vanepp/fritzing-parts

This branch is 23 commits ahead, 23 commits behind fritzing:develop.

... vanepp Arduino sensor shield V5, gear-motor, ky_006, shaft-encoder, yl99 parts

I think the problem here is getting my fork synced to the master correctly, despite the output from the git fetch --all, which looked like it should have done it, it doesn't seem to have updated my repo. I'm not sure how to do that other than the stackoverflow method using the github web page. I'd rather find the appropriate command line method to do that so I can do it entirely from the local cygwin command prompt if that is possible (which I expect it is if I knew how).

edit:

For reference here is the method I used to last sync my repo from the github web page. I can do this again, but as noted I'd rather find a way to do it via the command line:

sync the remote repository from github via the web

https://github.com/KirstieJane/STEMMRoleModels/wiki/Syncing-your-fork-to-the-original-repository-via-the-browser

The Stack Overflow link has pictures which are really helpful, but briefly, here's what you do:

Open your fork of the repository.

Click the compare button.  (right side just below Clone or download!)

This will open a page titled Comparing Changes and if you look carefully you'll have jumped to the upstream version of the repository. If you were to do a regular pull request then this makes sense as you'd be bringing your changes into the upstream version. But in this case we want to flip the direction and pull changes from the original version to our fork.

Change the base fork to your repository

You're now back to your fork but you've also asked to compare two identical repositories so GitHub thinks you care about branches not forks. Click on compare across forks to get back your base fork option. (end of the line below Comparing Changes)

Change the head fork to the upstream (original) repository

Note at this point that if you were in control of everything at GitHub you would probably just have put a little button in between the base for and head fork that would have flipped them for you rather than doing all these clicks. You might even had added in a separate button to check for upstream changes! But they do know that this is a bit of a silly hack and they're working hard on a bunch of other cool stuff so we'll let them off this one.

You'll see one of two options:

"There isn’t anything to compare" This means you're up to date and you don't have to do anything. Phew. :relieved:
A list of commits. These are the changes that have happened in the repository since you forked your version. Go to step 7.

Create a pull request

Note that this pull request is to you! So you can confirm that it's ok and merge it when necessary. And if there are any merge conflicts then it's up to you to figure out what's gone wrong and sort them out.

And now you're ready to continue working on your fork :smiley: :boom: :tada:

Well done!

modify a pull request

https://stackoverflow.com/questions/16748115/how-to-modify-github-pull-request

which says just the changes on to the same branch and they will magically appear in the pull request.

KjellMorgenstern commented 5 years ago

When you ran git push -f , where you on the develop branch? If you are on a different branch, it would try to push that one. You can checkout a specific branch with the command git checkout <branchname>

vanepp commented 5 years ago

Yep. This from the session just after the push -f $ git status On branch develop Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean

As far as I can see the problem seems to be that my fork on github isn't synced with the master at https://github.com/fritzing/fritzing-parts since the github web page on my parts fork thinks my fork is 25 commits behind master and 25 commits ahead of it (presumably my pull request) but as usual I'm not sure. Is there anything I can run either from my machine or the web page for my repo on github that will tell you anything useful? I was hoping the

$ git fetch --all Fetching origin Fetching upstream From https://github.com/vanepp/fritzing-parts ...

meant origin is my fork on github and upstream was https://github.com/fritzing/fritzing-parts, but perhaps that is wrong, and origin is my local repo and upstream is my fork on github and the main repository was never accessed as that would match what I'm seeing which is that my local repo matches my fork on github, but neither of them match the main repository. I see that after I manually synced my fork the last time and then cloned it locally I did a

git remote add upstream https://github.com/fritzing/fritzing-parts.git

which I assume is still there. That was in one of the web pages on making git work that I read trying to figure out what I'm doing wrong. With that in place I was able to do

git fetch upstream pull/141/head:pr-141

to download a pull request (for the first parts I think) to work on. So in theory upstream should be the main repository I think, it just doesn't seem to be updating correctly somehow. As usual github baffles me!

KjellMorgenstern commented 5 years ago

Which remote points to your fork https://github.com/vanepp/fritzing-parts, is it 'origin' or 'upstream' ? And maybe you have called you local 'develop' branch differently, for example 'vanepp-develop'? Assuming both is true, the command would then be used with those different names:

git rebase --onto upstream/develop vanepp-develop~1 vanepp-develop

To update the pull request, you must update the branch you created the pull request from, not the branch you are requesting to pull to (usually you do not have write access to that one, or should not directly push there, that is the idea of the pull request)

vanepp commented 5 years ago

That may have revealed the problem. Had to dig up the command to display the remotes:

$ git remote -v origin https://github.com/vanepp/fritzing-parts.git (fetch) origin https://github.com/vanepp/fritzing-parts.git (push) upstream https://github.com/vanepp/fritzing-parts.git (fetch) upstream https://github.com/vanepp/fritzing-parts.git (push)

Which may be where my problem is. origin and upstream are both my repo. I'll change upstream to

https://github.com/fritzing/fritzing-parts.git

and try again and see if things improve.

edit:

Change, but not success.

$ git remote remove upstream

$ git remote add upstream https://github.com/fritzing/fritzing-parts.git

$ git remote -v origin https://github.com/vanepp/fritzing-parts.git (fetch) origin https://github.com/vanepp/fritzing-parts.git (push) upstream https://github.com/fritzing/fritzing-parts.git (fetch) upstream https://github.com/fritzing/fritzing-parts.git (push)

$ git fetch --all Fetching origin Fetching upstream remote: Enumerating objects: 170, done. remote: Counting objects: 100% (170/170), done. remote: Compressing objects: 100% (58/58), done. remote: Total 170 (delta 114), reused 144 (delta 112), pack-reused 0 Receiving objects: 100% (170/170), 200.84 KiB | 11.16 MiB/s, done. Resolving deltas: 100% (114/114), completed with 9 local objects. From https://github.com/fritzing/fritzing-parts

which seems more hopeful as if it should be updating my repo to the master as the voltage_regulators branch wasn't there before.

$ git rebase --onto origin/develop develop~1 develop First, rewinding head to replay your work on top of it... Fast-forwarded develop to origin/develop.

but no indication this did anything

git push -f Username for 'https://github.com': Password for 'https://vanepp@github.com': Everything up-to-date

and after this no change I can see in the pull request and the web page on my forked repository is still showing it 25 commits behind master and 25 commits ahead. I see I had to do a pull request and merge in to my github repository to update via the web page, do I need to do something similar here to get my forked repository to sync to the master copy or should the fetch do that for itself? I just checked the branch list on my forked repository and the voltage_regulators branch is not showing up, I think indicating my forked repository hasn't been updated. Do I have origin and upstream backwards perhaps?

edit2

Looks like I am missing a merge step somewhere.

https://help.github.com/en/articles/syncing-a-fork

indicates I should do a

git fetch upstream

I think on my local repository (which in my case does nothing)

$ git fetch upstream $ which should make a new branch upstream/master (I assume upstream/develop in this case) which then needs to be merged in to develop on the local repository then the changes pushed which would update my fork on github and hopefully the pull request. However it doesn't seem to want to happen. I just had the thought the maybe the original git fetch --all did made such a branch and thus there is nothing to do, but it doesn't appear so:

$ git branch arduino-sensor-shield

no upstream/develop branch in the local repo to merge.

vanepp commented 5 years ago

At this point I think I have managed to get my fork synced to the master, but this pull request is still broken. I'll try closing this pull request and redo it from the now hopefully synced repo and see if that works better.