git problem with merge

i have a branch glfw-example in my local git repo that is not updated with the last changes in the develop-raspberrypi . i did this:

git checkout glfw-example  
git fetch upstream  
git merge develop-raspberrypi  

but this seems that’s not correct. Have you an idea how to proceed in a right and efficient way?


also i have problem updating develop-raspberrypi branch:
i did:

git checkout develop-raspberrypi  
git fetch upstream  
git merge upstream/develop-raspberrypi  

that should do the right thing. but there is some conflict as you can see the log attached. ofAppGlutWindow.cpp differ from upstream , i don’t remember to do something with it but i checked and it differ . i changed it to make it as the upstream version but i think i’m not sure to do the right procedure.

after changing the file and saved i did as suggested from git:

git add libs/openFrameworks/app/ofAppGlutWindow.cpp  
git commit -a  
git merge upstream/develop-raspberrypi  

look also:


in both posts, what you did was correct.
a merge conflict is something “normal”. basically your remote branch has some changes where you also made changes, and git can’t automatically decide which one is correct.

if you get a merge conflict, say “git mergetool” which will start some software which helps you decide the correct version (i prefer kdiff3, but any diff-style application is fine)
after solving the conflict, just doing as you did above should have resulted in a clean merge - did it not?

also, the push command in the beginning of the log indicates that your local and origin history don’t agree. seems you have rewritten history at some point? you could try to solve this with git checkout ; git reset --hard origin/ or so (haven’t tried this) , but beware, you can erase local changes!

@bilderbuchi your suggestion helped me. I used kdiff3, it’s a good tool. and yes, i was using the fine commands. not very understood the reasons of my troubles. Now i have my local and origin repo in sync , but strange when i switch to glfw-example branch with ‘git checkout’ i had to add some files missed ( but in theory should updated to the news commits of develop-raspberrypi branch) . I think i did a lot of errors before. I hope there is not too much unexpected garbage code or possible conflicts… because i would contribute a bit to OF development. I think i have to learn yet a lot ‘git’.

i think it will happens again such kind of issues, because i have a 2 local git OF repo for my notebook(windows and Ubuntu) another for my Pandaboard and another for raspberrypi. Do you know a smart way to sync all this? there is some software tools for this?

best way to sync is via your github repository (i.e. origin) or by having just one OF repo locally (and work with branches/tags, which I prefer).
we have a doc for a git workflow introduction, check it out: