For development in Xcode 10.x, how well does the git integration work with github? - xcode

Since Apple has pulled subversion integration from Xcode (and Perforce never choose to directly support that integration since Xcode 3), it seems as if git is the only fully integrated source code control system for MacOS and IOS development.
How well does Xcode 10.x integration work with GitHub?
In addition to Xcode's integration, what are some polished MacOS apps that serve as stand-alone git clients?
My experience with the git command line has not been great: I'm always getting into trouble where the repository gets messed up ("detached heads", for example) and it seems to take someone with a PhD in git to get me back to a functional, stable repository. Will GitHub help in those situations?

Xcode 10 integration with git is very intuitive and reliable. You can use Xcode for commit, push and see history of commits and so forth. Also Github macOS application works fine but I personally prefer Xcode to do so.

Using Xcode 10.2.1 with git and GitHub, brought me many troubles. I lost one day of development, because even though committing seemed fine inside Xcode, no commit was performed on the local .git repository nor on the remote Github repository.
The only way to recover a proper functionality was to checkout to the last committed version and loose all the job in between.
I have not been able to figure out the exact cause, but I noticed that opening several projects in Xcode and/or using playgrounds while developing on a project seems to corrupt Xcode git functionality. Quitting and relaunching Xcode corrects the trouble, most of the time ...

Related

How to Add Xcode project to Github repository from windows environment

After seeing title of my question you might think like this kind of question is already been asked before. However this is not duplicate, read below to know.
I am developing IOS application. Whenever I get time I work on that every time I use either library's PC or friend's MacBook to developing or making changes in my existing project and then I compress the project and upload it to my Google drive.
I would like to add my Xcode project to Github. I know how to do it from MacBook though. I am looking for way to push my Xcode project from windows environment. As I am poor fellow and can not afford MacBook at the moment.
or
If is there any way I can push my project to same repo on Github from different MacBook every time. As I mentioned before I am using public library to work on my IOS app it is not possible that I can be able to use same Apple PC every time.
Make in windows console -
cd /path/to/my/repo
git remote add origin https://github.com/UserExample/ExampleProject
git push -u origin --all
There is a variety of ways to use GIT within Windows. Github is just a GIT repository cloud service. You can fetch, push, pull command line, after installing GIT on your Windows machine and then CD changing directory to your repository (where the source code is) on your Windows hard drive.
Since you are new to GIT and Github, use the very user friendly Github tool:
Github Desktop
You will be able to use use the existing repository on your Windows hard drive, or if it gets confusing via the Github Desktop to "connect" an existing local repository to the Github repository (https:www.github/myrep). Then just backup your working project to a backup folder and clone the Github repo you are using.

How to set Xcode Bot to run "on commit" for all branches of remote repository?

When creating an Xcode Bot in Xcode 6, it is linked to the current active branch in Xcode source control. There seems to be no supported way to change branches after creating the bot.
Xcode Service: Select Git Branch
I have set my bot to run "on commit". I find when I commit to that branch the bot immediately integrates the project. But when I commit to a different branch, the bot takes no action.
Ideally I would like a single Xcode Bot to look at all branches of the remote repository. When there is a new commit to any branch the bot and its tests should be run.
I do not want to create a new bot for each branch. Is there a solution?
Bug Report:
rdar://20154198
Developer Forum:
https://devforums.apple.com/thread/263490
There is also https://github.com/modcloth-labs/XBotBuilder developed by the same creators of the tool #jeremy-fox. It will create a bot per Pull Request, and re-run the bot for every addition in the PR.
It seems to be in early stages and without documentation but the code seems to be well organized so wouldn't be hard to get it to work or change it's behavior to do what you want.
For the moment we use a tool called Buildasaur (https://github.com/czechboy0/Buildasaur) to improve our CI-workflow. It's written in swift and helps to build/run/ delete bots automatically for one github repository, for example whenever a pullrequest was created or newer commits were pushed to the pullrequest. Actually it works fine on our Xcode Server 6.3. Unfortunately it works for just one repository at the same time. :-(
We also hope, that Apple will implement such features soon.
Apple response from the dev forum:
This isn't something Xcode Server supports. You might be able to craft a pre-integration trigger to switch branches in the working copy and invoke seperate xcodebuild invocations, but the results reported in the UI will only be for the Xcode Server builds (the build that XCS runs after your trigger executes).
https://devforums.apple.com/thread/263490
rdar://20154198
This is not currently possible with Xcode Bots (current versions are Xcode Server 4.0.3 & Xcode 6.2). A Bot will only track the specific branch form which it was created.
This was possible in the past on Xcode Server 3 and Xcode 5 using https://github.com/modcloth-labs/github-xcode-bot-builder but this project hasn't been updated to work with the latest version of Xcode Server and Xcode.
I'm also really hoping Apple introduces this feature soon, it would be great to be able to have a single bot monitoring a repo for new Pull Requests and when found run an integration against that PR. For now though, it's just not possible.
Update 3/19/2015:
As #Gus reports in another answer, there is a new Mac OS X based project that can help with ad hoc bot creation for feature branches/PR's called XBotBuilder - https://github.com/modcloth-labs/XBotBuilder. It should be worth noting that currently, this project only works with one github repo. So, if you have more than one repo you'd like to monitor for PR's, this is still not currently possible unless you have multiple machines each running a different instance of XBotBuilder and targeting a different repo.

Using both Xcode and Terminal for git commands

I am new to using git and I followed some instructions for using it directly form the terminal. I noticed when I opened the project that Xcode also showed this repository clearly, even though it was an existing project and Xcode did not itself create the repository (I didn't have that option checked when the project was created).
I read on this question that Xcode keeps its repositories separate from the repository created using git manually from terminal. Yet, my experience suggests Xcode is in fact finding it fine.
My questions are simply:
Does it matter from the sake of functionality whether the repository is created with Xcode or manually from the terminal?
Can the two be used interchangeably on the same project? Will the same repository be used?
Is perhaps the latest Xcode 4.6 and improvement in this area and this is why the above-linked question suggested problems that I am not encountering?
I read on this question that Xcode keeps its repositories separate from the repository created using git manually from terminal. Yet, my experience suggests Xcode is in fact finding it fine.
You are right, it is fine (at least for what I use it for).
Does it matter from the sake of functionality whether the repository is created with Xcode or manually from the terminal?
No, it doesn't.
Can the two be used interchangeably on the same project? Will the same repository be used?
Yes and yes.
Is perhaps the latest Xcode 4.6 and improvement in this area and this is why the above-linked question suggested problems that I am not encountering?
Likely, although at least with Xcode 4.5 it worked for me as well.

xcode git pull/push crash

When using the xCode IDE when selecting file -> Source Control -> Pull or Push xCode crashes. The only workaround so far found for this is to load the organiser and select each repository and click pull then when then repository name displays cancel the dialog. After repeating this for each repository the normal push/pull options work fine until Xcode is restarted and then the process must be repeated.
This happens the same on all machines (4) at our office. The repositories are on github and there are multiple repositories being loaded in for each project.
We having been using the work around for some time but as we get more repositories this becomes more of an annoyance. Any suggestions welcomed.
I had the same issues with Xcode 4.3 so I have been using Xcode 4.4 and 4.5 for development (I'm not close the delivering yet, so it doesn't matter than I cannot submit my App using these versions yet).
An alternative would be to use an external source control tool; I would recommend SourceTree as it's free and works well. Other than that, there is always the command line.

XCode4 with external git

How do I add an external git repo (such as code.google.com) to Xcode with my project. All I am able to get is to add in the repo, but not use it with any projects. I have been trying the command line options from various websites with no success.
I find XCode has rather rudimentary SCM support. Do yourself a favour and use either the command line or a GUI client, you'll save headaches when things go wrong and the built in client with xcode doesn't always reveal things. Xcode is happy to look at the .git files or .svn files and tell if the status which is useful, but that's as far as I let it go.
Xcode will create and manage the repository for you locally, but you will need to push your commits using the command line.
I've been using it with GitHub, and ran into no issues so far.
Once you push your repo to the web server, all the local commits will sync and upload.
SourceTree is excellent, I use it and the CLI
http://itunes.apple.com/us/app/sourcetree-git-hg/id411678673?mt=12

Resources