How can I use git from within Xcode? - xcode

How can I use git from within Xcode? I've found SVN easy to use from Xcode; can I use git as easily?

You CAN use git easily from Xcode. Easily, but not well.
One of the design decisions Apple made with Xcode was to present a unified interface to version management regardless of what version control system was on the back-end. So if you're using git, you only get the subset of git functionality that svn also supports. No index, no stash, not really even branching.
I've quit trying to use Xcode's onboard git "integration". It's broken by design.

In XCode 4 you get git support natively.
There's a buch of documentations on the internet:
https://github.com/blog/810-xcode-4-released-with-git-integration
http://oleb.net/blog/2011/05/on-git-support-in-xcode-4/
Official doc here.
Also, Google has LOADS of results on this matter...

Related

Is CocoaPods Used in Production?

I am not entirely sure if this is the appropriate place to ask this question, but given that CocoaPods is a third-party Xcode plugin not made by Apple is CocoaPods ever used in the professional computer science industry? I know several apps made by fellow individual developers that utilize CocoaPods because it's one less headache (same reason I like the idea), but is it even worth getting familiar with if companies you are interested in working at that make iOS apps don't even use it? Or do companies not care and leave it entirely up to the developer?
Cocoapods is just a tool to find, clone, build, and link against app dependancies. Ultimately, it just creates an .xcworkspace where all of the dependancies are linked to your main app. While Cocoapods isn't a first-party tool, it's only job is to create and configure an .xcworkspace, which is a first party tool. Everything Cocoapods does could be done manually using Xcode.
It's also worth mentioning Carthage as another alternative for dependency management. Carthage simple clones and builds frameworks, it leaves it up to you to drag them into your .xcodeproj and link them. This is a less intrusive approach in that it doesn't create or require an xcworkspace.
EDIT: To address your specific question, yes, both Cocoapods and Carthage have widespread, almost ubiquitous use in the professional world. These tools have become the defacto standard for managing dependancies in Xcode. While you can get by without them, doing this all manually is error prone and wastes time when we have established conventions.
While I can't speak to closed source software such as Google's apps, the fact that they offer pods is a clear indicator that they expect you as a developer to use them. You don't see any instructions from Google on how to setup/build their frameworks from a git submodule now do you?
CocoaPods is a dependency manager for Objective-C and Swift. Many developers add their libraries to CocoaPods. By using it, you're enabling your projects to scale in a reliable way.
You don't have to use CocoaPods. You could always manually add a library to your project, but CocoaPods has become a standard in the professional iOS development industry for its elegance and dependability. CocoaPods is sponsored by big companies, like Capital One. Stripe uses it (http://github.com/stripe/stripe-ios). So does Twitter (http://dev.twitter.com/mopub/ios/getting-started).
CocoaPods is not very hard to learn at all if you want to get started in it. Yes, it seems scary because it creates an xcworkspace, but it only takes about two minutes to first start using it. And for the record – you're simply working on your project by opening up your xcworkspace instead of xcodeproj. Nothing too frightening ;)
The official getting started guide: https://guides.cocoapods.org/using/getting-started.html
A helpful tutorial that walks you through it: https://www.raywenderlich.com/97014/use-cocoapods-with-swift

Xcode 6.x Yosemite not syncing properly to svn from previous projects

Is this happening to others out there?
Ever since my team has upgraded to Yosemite and Xcode 6, 6.1, 6.2 we can not interact with our existing svn via the Xcode UI very well. The status icons do work, but seem sluggish, and we can not update or commit using the mouse right click feature for individual classes.
We can do diffs, commits, and updates via the terminal just fine.
I reverted my brew svn 1.8 installation back to 1.7.19(which is what the rest of the teams is using) because it wouldn't work at all with the Xcode UI.
What I have tried:
Several examples on the web and on SO on how to install svn 1.8.x and get it to work with Xcode. Others just talk about linking svn files, and toolchains, each of which stop any functionality with Xcode.
svn 1.8 working with xcode
Using svn 1.8.3 with Xcode 5
I've also tried checking out a fresh copy of the branch using the UI. It checks it out successfully, but doesn't interact any better.
I have Xcode 6.2 installed with Xcode 6.2 dev tools, so that should not be the issue.
Any advice appreciated.
If you're still looking for an answer, https://gist.github.com/PeterLi/0146930c9e04c962afe9 certainly provides a correct set of instructions. We've used it every time we upgraded Xcode (6.1, 6.2, etc.). Make sure you follow the instructions fully including at the very bottom of that post.

What is the best ruby api to git?

I would like to implement a Rake task that automates some of the tasks I have to do to move my changes from development to production (and yes, I know there is something out like Capistrano, and it is way too much for me). In the center, there are some interactive commands like git add -i and a series of commit and push. On the production side, there will be pulls and assets tasks to do.
It is tedious to type in all the time the same commands so I would like to automate it completely. What I have not found is the Ruby API for Git.
It should work under Windows 7, and allow at least the following commands: git add, git status, git commit, git push, git pull.
I know, bad habit, but I would like to document the experiences of this weekend:
There is a similar question on https://softwareengineering.stackexchange.com/questions/62843/best-ruby-git-library that names the 3 relevant candidates: Git, Grit and Rugged.
Git and Grit are not developed further, Rugged is currently developed, but not finished.
Git works out of the box, but has some deficiencies:
There are known shortcomings (see the issues).
I had the problem, that added and changed items are not well matched, they can be in only one of the 2 states (which is not true for Git currently).
The API is reasonable, and works well in console, Ruby script or Rake task.
Grit did not work for me at all, and I did not found the reason. I got stack traces (low level ones), and tried a few patches that could be relevant for usage under Windows 7, but with no success.
Rugged is not installable for me, so I filed a bug to rugged which got some feedback. The problem seems to be that rugged only works for POSIX systems, so it is not compilable with DevKit for Ruby.
So I will try to find a compiled version of libgit2.dll for Windows 7, and will try to use that. I have done that in the past with sqlite3.dll, so perhaps that is the best try. For me, rugged is the most sensible solution, because there are people behind that project, they are interested to provide a solution that works cross platform.
This one seems to be quite popular. If you are more interested in GitHub then you might want to look at this one.
UPDATE:
Rugged seems to be the newest one out there though the Gem for it has not been built in a while. Might be best to use the source from Github.
July 2013 update:
It looks like Rugged is the tool of choice at the moment. It is being actively maintained and it looks like most (all) of the core committers work at github.
Even though grit is the most popular, and is created by one of the github founders, it hasn't been touched for 5 months and has had little activity.
See Ruby-Toolbox for details.

Tutorial on GIT with Xcode

I'm trying to understand how to use GIT with Xcode 4.2.
I haven't been using GIT actively, but while I was walking through a couple of git operations mentioned in this link it appears that I have a single repository with many projects in it and a recent project in a repository all by itself.
I want to carefully take the project I am currently working on and put it into its own repository so I can safely leverage some of the branching capabilities.
I'm hesitant to begin until I have a better understanding of what's going on. I'd like to know how much is handled within Xcode and what I have to do at the command line.
#manojids comment to learn a source control system (like git) outside of a specific editors integration is a good point. Try to understand the source control system. The integration is a convenience, not a crutch.
Outside of that advice, apple has some docs outlining specifics of how XCode works with git. Here's the link:
http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/SCM/SCM.html
A good online resource is the pro git book available here:
http://git-scm.com/book
If you want to learn and understand Git and its concepts in detail then this book would be best for you here is the link.
Or you can have a drill on it practically if you follow this tutorial.
I hope you will get help.

XCode and SCM conflicts

Is there a decent Subversion client available for XCode? I am so tempted to write my own as of this morning after having a conflict on an update. I've done merges manually editing the ">>> mine" and "<<< theirs" markers but there has GOT to be a better way in this day and age. Does anyone know of an easy way to resolve conflicts graphically? It seems like SCM conflicts and svn history queries are my two most missed features in all of the Mac SVN clients I've seen so far. I use Versions and sometimes the built in XCode SCM support. I've also looked briefly at Cornerstones web site. (Is Cornerstone any better?) Does anyone have any ideas?
I'd suggest using git-svn with GitX for most things. The GitX commit interface is so nice it's really hard to go back to anything else.
For conflicts I use Emacs, which offers really nice, fully editable, color-coded 3-way merge.
You also might check out the WWDC 2010 videos/slides (free at Apple's site if you're a registered developer) regarding SCM support in the upcoming version of Xcode.
As a GUI, SmartSVN offers a basic conflict editor (though I find the the application very slow to refresh on a large source tree). Often I find myself going back to Emacs which has support for subversion via Psvn.el, and that has a very capable 3 way diff with ancestor revisions, custom region skipping and other goodies.

Resources