github/xCode synchro issue

Hello,

I’m sorry if stupid question, but I am new in github, and in programming at all.

I have impression, that synchronising github with xCode doesn’t work properly.

I mean for example: when I delete branch from github (on github website) the branch still exist in xCode, and then when I launch xCode, and make some changes in other branch (eg. master) and I commit those changes to github, suddenly on github my old branch (which I deleted before on website) appears again. So I have some mess with branches. In xCode there are two folders with branches, like local branches, and remote branches. And all of them are the same. I suppose “remote” means those branches on github… but why…how to use it… for what… where??? :slight_smile:

To much questions and misunderstanding for me. Is there any tutorial which precisely explain all those aspects?

Of course I was looking for tutorials on google, but there are a lot of tutorials. I watched some of them, but there was not answers for my questions. Those tutorials mainly are about setup xCode with github, and some features explaination. But I don’t have time to watch all those tutorials. So maybe you know one that explain all functions step by step about xCode and github together?

For any help thanks in advance.

Hi,

I think you may be misunderstanding branches a bit.

GIt doesn’t ‘synchronize’ a whole project. It keeps track of changes per branch. If you locally have a branch test  and you push this to GitHub, GitHub now has that branch.

If you then delete test on GitHub, GitHub doesn’t have the branch anymore. However, your computer still has the test  branch. So to delete a branch you will need to manually delete the branch locally as well.

If you then push the branch again,  uploads the whole branch AGAIN  to GitHub. So altough it may seem that your old branch just popped up again, that is just because it was uploaded all over again.

So when working with branches and Git just keep in mind that Git does not ‘synchronize’ ** branches.**

If you still have problems, don’t hesitate to ask again.

EDIT:  So this also isn’t an XCode issue.

Great thanks for your reply. I understand much more now.
But now I wonder about two questions (two on the beginning :)):
There is possibility on github website to make some small editing in files. So if I do so, and github doesn’t synchronize it, so locally I will not see those changes. So there will be mess. Isn’t it? I though github is not only for backup, but also for synchronizing. Isn’t it? A lot of people say github is good when you work with multiple developers, and help them to keep project synchronised. But no you say something oposite?

  1. There are some functions on github like: push request, merge branches etc. Can I use that functions in xCode also? O only through hithub website. If I can do it in xCode, will it be also only locally?

For any help greate thanks in advance. Best regards.

**1) **No, it won’t automatically downloaded to your computer if you make edits online. However (and this is much easier if you work alone) if you aren’t editing the same files on your PC and online it won’t be that much of a mess and a 

git pull origin branch

will merge your online edits and your local changes. I use this sometimes to change a file that just holds the version number. I work mostly alone and make sure that I only edit certain files online, and the files that I edit online (version files, licenses, etc.) I don’t edit offline.

2) I really don’t know XCode but I think it just has an implementation of Git like Atom does (however, if you work with XCode you probably don’t know Atom). Whatever it is, it probably will only be in  your local Git repo. Then you will have to manually push and pull to GitHub. At least in Atom and probably also in XCode it is just some kind of integrated visual interface for  your local Git repo , so it won’t be synchronized automatically but you can easily do so by pushing/pulling.

OK, great thanks for your support,

It is much more clear for me now. Thanks