Including a cloned repo in a git repo - macos

I'm writing an app in xcode, and I'm using git (though using the github app to commit and manage it, not xcode) for version control.
I use PXSourceList in the project, which I've cloned to my computer. I include the files as references in Xcode, so this means they aren't part of my git repo which syncs to github. So if someone were to download or clone from github they wouldn't be able to build without getting PXSourceList themself. How do I include PXSourceList, so that it is "referenced" in my repository?
Both on my computer (to my local clone) and on github (to PXSourceList on github)? So that PXSourceList will stay up to date in my repo when changes are made to it by others independant of my repo?

Subrepo or git-subtree. You have to move PXSourceList into your project tree in both cases

Related

GitHub - how to update repo

I downloaded the folder from my Github project and edited it with visual studio. I want to connect this new folder to the same Github repo I downloaded from. Is this possible or will I have to make a new repo?
It's duplicated: Pushing to Github
I assume that, you have cloned the repo, didn't downloaded as a .zip.
Everything what you need to know about pushing changes to remote is here: Github Push. For more detailed view look at here git-push.
I usually use some GUI for git (TortoiseGit). To do this from a cli you have to write:
git push --all
After this git will ask you about credentials to you repo. This is really basic way but is good at the beginning.

How to pull files from github branch to xcode directly?

I have a project created for me by teacher and I have to improve it. He created a repo on Git Hub with branch for me. I'm trying to pull the project files from that branch directly to Xcode and Xcode refers to the branches that I have created which are empty, not the master one. Can't find any adequate manual for that as well... Please help...
so github uses git to manage repositories, so this question has more to do with git than with github.
Git is a distributed-repository source-control system, which means that every machine has a full copy of the repository, with all of its history and branches. This means that your local repository that you cloned from GitHub has all of the branches on it.
So, your problem is actually just that you need to switch branches locally to the branch your professor created.
In a terminal you can execute
git checkout <the-name-of-the-branch-your-teacher-created>
and that should do it. :)
Xcode is simply looking at the files in your working directory, so switching branches will update the files in Xcode as well.
For more git information check out the git book or any of the other countless git resources online!
Well using Git is fairly simple and as specified above can pull the project (either complete of specific brach and then import it.
OR
While running Xcode you can follow below steps -
Click on Check out an existing project.
Enter Repo link as shown below and hit Next.
Select the branch that you want to pull and hit Next.
Note As shown in Image Xcode version 8.2.1 is used.

Adding an iPhone Project to an existing Github Project

I'm working on a bit of documentation code for an API project.
Someone else already has an existing github account where some people have already submitted a few projects. I will call it {http://github.com/monkeyhouse/}
I've created a project in Xcode (iPhone app), and have that stored under my normal Xcode git, which is backed up everything is fine.
What is the right bit of git foo that I need to put Xcode Project into
{http://github.com/monkeyhouse/examples/iPhoneClient}
I've tried creating a symbolic link to the project on my machine and that didn't work.
Following is a common way to do what you're wanting to do on Github:
Fork http://github.com/monkeyhouse/ under your own Github account.
Clone your forked version of the repo to your development machine.
Make the modifications you want directly to your cloned repo (e.g., don't use a symlink), adding examples/iPhoneClient to the local repo, and commit the changes.
Push your changes to your public Github fork of http://github.com/monkeyhouse/.
Submit a pull request with http://github.com/monkeyhouse/ to have them bring in the changes you pushed to your forked version if they're happy with them.

Loading Xcode 4 git repository onto Bitbucket

I have an Xcode project with a few commits, and now I would like to load it onto Bitbucket, without losing my commit history. What would be the best way to do this?
Create a new repository, and push to it from Xcode like normal. It will preserve all of the commit history.
You could follow the Import Code into (BitBucket) repo, and select a Git repo on your local workstation.
The fact that this local repo is managed by XCode4 doesn't matter.
After the import, you can add your Bitbucket repo as a remote, with an https address, as mentioned in "Bitbucket + XCode 4.2 + Git" (even though the XCode GUI might not be enough, and some command lines might be needed).

Understanding Git with XCode and BitBucket

After following several tutorials I was finally able to take my existing, non-Git-Repository XCode Project and get it uploaded to a repository on BitBucket. I'm completely new to git but I'd like to start working with versioning. Since I'm a complete newb I'd rather not be working with the command line all day (which is what I had to do to get the project on BitBucket).
XCode's organizer now has access to the BitBucket repository. I successfully cloned the project back to my hard drive. My question is this: From now on, will the projects be in sync with each other? I'm not familiar with the lingo, and the difference between a branch and a fork. Essentially, I uploaded a 1.0 codebase and I want to start working on 1.1. I'd like to either fork the code or branch it so that the original project remains for reference. From what it appears, when I clone to my hard disk, XCode creates a new local repository instead of saving it on BitBucket.
I'm confused, please help!
Forking is a server-side operation where you clone the repo. For BitBucket, it is generally used with Mercurial (see "Forking a Bitbucket Repository").
This isn't what you have done.
You have simply cloned your BitBucket Git repo (now that BitBucket also support Git, and not just SVN and Mercurial) into a local repo and imported it in your XCode editor.
You can check it through command-line (git remote) or in XCode (See "Version Control System with XCode 4 and Git").
Note that you need to use an https address for your BitBucket clone address for being able to push back to the BitBucket repo from your XCode-managed local repo: see "Bitbucket + XCode 4.2 + Git".
For more on the basis of Git (especially branches), you can follow first the small labs from gitimmersion.com.
What you want to do is Branch your code from your 'master' i.e. your 1.0, to a 'develop' branch i.e. your 1.1 version. This is the simplest way for you to start getting used to version control. Once you create the branch using Xcode, the project in Xcode you are working on locally will be on that branch.
As you make changes to the code on that branch, 'commit' them from Xcode, and then 'Push' them up to Bitbucket (all done from the same menu in Xcode File>Source Control>...Xcode will ask during a push which branch to send changes to so make sure you select your Develop branch.
This will keep your local copy and your remote repo in sync as you develop your code.
This chapter in the Xcode user guide helped me immensely:
https://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/SCM/SCM.html
How often you should do the commit and push dance will come from experience.
Good Luck.

Resources