My friend and I are creating an app and we are wondering if there is a way where we can both edit the code at the same time?
Don't use SVN. You will see how easy version control could be and later everywhere on the job people will use Git because it is "better" and you will get frustrated.
Just use Git from the beginning, stay happy, you will love it. Really! š
The default in Xcode is Git too, so it can't be wrong.
Just be aware that the interface in Xcode is offering you a filtered version of the Git commands. As soon as you really need it for anything you will end up on the command line.
Whatever you try there, the first few times it will fail until you have learned the propper syntax and all side effects. So just make a copy of the folder, or zip or tar it before you try it a simple git command.
Also SourceTree is nice, but same problem there, learn what every command really does.
Use git! Lets people edit code and track the progress of the project (among many other useful tools).
Git Tutorial
If you are looking for more of a 'Google Docs' atmosphere, I would look into Codr or Cloud9
You can use SourceTree a free git repository handler.
Related
I want to run git command in my app, so I can git pull/commit/clone with the repo. Is it possible? How to do? I search for google for the topic , and cannot find the answer. Any idea, thanks a lot.!
Git is not available on iOS like it is available on OS X. On OS X you can call any command line command using NSTask, but NSTask is not available on iOS.
The only way to achieve what you want to do is get the Git source code and include it in your app.
Remember that normally the user interfaces with the app by executing the program 'git' and giving as arguments for instance clone <myRepo>. This means that the program 'git' gets two args in the main function and from their does what needs to be done. The program git does not exist in you case, as that is now your app, and the arguments can still be the same, e.g. via textfields.
Git is open source https://github.com/git/git and written in C. So in theory you could include it as library in your application.
There is a git client on AppStore so its definitely doable https://itunes.apple.com/us/app/working-copy-powerful-git/id896694807?mt=8
But I don't image that it will be super straight forward and would not recommend it unless you have a lot of time on your hands
I'm really new on git, and things are really complicated. I really need all of your help!
I don't know where is the mistake so I will tell my all story from the beginning. I was working on another computer, and were able to push without an issue. Then I changed to my current computer, so download from the web (which is visual studio btw) my project, directly with the download button. Then I start working on my new project. Yesterday, I tried pushed and it told me "Everything is up-to-date". Thought, didn't accept my push. I just nevermind yesterday and continue working. Today, I tried pushing again but I figured out I didn't commit yet. So from XCode, from to top bar I go for commit and then opened the terminal again. Tried to push one more time, but here my problem is started. Because of I was working cocoapods, I was working from .xcworkspace. With the push, I am now not able to open my project. It started giving me error "Workspace Integrity(Couldn't load project). Tried re-opening several times, but ofc, didn't work. So, I still assume that is because of the push and if I handle the push problem that will also fixed. To be able to push, I found that I need to pull then push. So I tried to pull, but that also gave me the error of being unmerged files. Then, I decided to figure out a way to merge, but those I found on the net, especially on stack, there are nothing worked for me.
Things are complicated for me then you thought, because I really don't know what is git at all and it just came up with all of these error. There are lots of errors and I'm really confused.
I really need someone to help me deeply, at least telling me a way to out.
Hope that long story don't scare you, as I am scared too.
Thanks from now,
Waiting for your guidance, desperately!
You should try issuing a git fetch, and then a git merge from the terminal. This is usually a better way than to use git pull. git status is your best friend too, it will show any files that have not been added to your staging area. If you have files that have not been added yet, you can either run a git add <filenames> or you can commit and add at the same time with
git commit -a -m "commit message"
Hope this helps at least a little.
Also, you definitely don't want to corrupt your remote repo, so don't push your local repo if it's bad. If your remote repo is still okay, you can clone it again, and add the changes that you made yesterday and today manually, not ideal, but it might be your only choice if you can't open your files.
My iOS app is having a strange core data bug, and I contacted Apple's developer technical support for help. They are asking me to submit a copy of the offending code, so they can see what is going on exactly and help me identify the problem, but as one would expect I don't want to give them all my code, not only because it is proprietary but also because I want them to be able to identify the arts of the code that are having issues.
So I have removed 95% pf my code so that the app still builds and loads, and the problem can be demonstrated. I would like to provide them with a git repository, so that the developer who looks at my code can see how the changes I am making creates the bug.
However, I don't want to send them the whole git repository as it stands because the history would allow them to just go back in time, and undo all of the deleting work that I did. What is the proper way to go about "pruning" a copy of my git repository, so that a particular commit will become the root of the new commit tree?
You can delete a given file/files using git filter-branch.
See here:
https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html
Specifically, you may use the following example to delete a file named as filename:
git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD
It seems that all of the initial Google results for "using subversion with xcode" are actually just tutorials for installing and configuring svn and Xcode, as opposed to actually using the two (i.e. interacting with svn via Xcode's GUI).
Is anyone aware of a good guide that teaches the tricks and pitfalls of working with svn via Xcode's GUI? Something that bridges the gap between the most excellent Version Control with Subversion book and the Xcode IDE (as in pure Xcode GUI without any terminal command use)?
Edit:
We all love our terminal commands, and we all love Eclipse but (and I mean this in the nicest possible way) neither is really the point of the question. Iād prefer to use svn via Xcodeās IDE instead of via terminal just as I prefer (well, for this case) to code in Xcodeās IDE instead of using vim and gcc. Apple engineers spent a good bit of time implementing that SCM menu in Xcode; someone has to have seen a usage guide somewhere.
I used this page as a reference for setting up my XCode projects with SVN. It is a good starting point, but I'll give a short walkthrough of what I did (since the page isn't really all that helpful!).
A couple notes: I'm using XCode 3.1.2 and Subversion 1.4.2. I've heard of problems with using SVN 1.5, but there are ways around that which I wont get into.
First off, I had a repository already set up and created the XCode project afterwards.
In XCode you need to set it up to know about your repository using the SCM tab in the preferences window. Enter:
A Name (this is arbitrary and used for reference with XCode)
The scheme (http or svn)
The host (i.e. svn.example.com)
The path (the exact path to the SVN repository located on the host)
The port (only if it isn't the default)
And a username and password used to access the repository.
The URL will be auto-filled as you enter the other fields. Hit "OK" when all the fields are good and XCode says it can connect.
Then open your project and do a "Get Info" (Round blue icon with an exclamation mark) on the project itself. Under the "General" tab down at the bottom is an option for SCM, select the repository you made in 1 and close the window.
Now open SCM in the menu-bar and go to "Repositories." Hopefully you've built your repository right using branches, trunk, and other directories at the base level because XCode doesn't have support for checking out the root directory. So go one directory at a time down the list and click the "Checkout" button and select a directory to check it out to (I recommend a "Code" or "Source" or "SVN" directory inside your XCode project directory). You cannot checkout multiple directories at once, but you can tell the next directory to checkout before the first has finished and XCode with queue the commands.
Once that is all done go back to your XCode project window and "Add -> Existing Files..." to your project. Select the directory you've checked out the repository to and I recommend using the "Create folder references" option instead of the "Recursively create groups" option because added and removed items will be automatically reflected in a Folder Reference but not in a Group.
Now you've imported your SVN repository into an XCode project. From here any time you make a change, simply Right-Click (Control-Click if you only have 1 button) in the file and at the bottom of the context menu are the SCM options for comparing, committing, updating, and discarding (reverting) the file. You can also use the SCM menu in the menubar for file or project-wide updates/commits/reverts.
I second the comment by the_mandrill, SVN support from within XCode is very limited, especially if you're used to Eclipse.
I also don't understand why everyone seems to need visual clients. I keep a terminal window open on my project directory and I have no problems interacting with SVN from the command line.
I know this is not quite what you asked, but I wouldn't rely much on the use of SVN from Xcode as what you can do with it is very limited. It's useful for being able to do a diff or annotate direct from the IDE but not a great deal else. I don't think it's any substitute for using a separate standalone client such as SmartSVN or Versions.
You also have to jump through a number of hoops to get Xcode to work with SVN version 1.5 onwards, so that's something to be aware of before installing a standalone client. If in doubt, check out a sandbox first.
Here is one of the best tutorials to configure subversion in XCode - http://iphonedevelopment.blogspot.com/2009/03/version-control-is-your-friend.html
It also teaches even to create repository in local MAC.
if you want to work with svn through a gui interface then i suggest you use eclipse + subclipse plugin (which have more features and much more reliable and easy than svn on xcode)..
you will work in xcode as normal but you will use eclipse only as an svn client (by creating a general project in eclipse and make it points to your xcode project directory )
and here is a tutorial of how to install subclipse
A lot of people have problems using the build in svn client, especially to get a new project into svn and that it works.
I created a straight foreward tutorial on how to do this, along with a very well known pitfall (works for Xcode up till the latest version of xcode incl. Iphone 4 sdk)
http://www.sodeso.nl/?p=599
I myself looked up for some good resources and one of the best I've found is a quite recent video from the WWDC 2012 :
Sign in here if it's not already the case : https://developer.apple.com/videos/wwdc/2012/
Then there is a video called :Session 411 - Source Control Management in Xcode
It explains how to use version control both with GIT and Subversion. It's really nice !
Hope it helps!
As has been mentioned in many other answers, the svn client with Xcode is quite weak (and that is being kind).
Personally, I think that running Eclipse just to get access to a svn client is a bit heavy handed.
I would suggest two answers:
Use a dedicated svn client for the Mac (Versions and Cornerstone are both very good, albeit not free... there are free ones, such as svnX)
If you are not wildly comfortable with the terminal, you can script a couple of the key commands that you want to use and add them to your Xcode user scripts folder, then you can trigger them from a menu item of from a keystroke, just as if you were using the Xcode native client. There's a ton of examples on how to do this available via Google.
I came across these - no idea how well they work, but wanted to add some resources if I could:
http://www.macresearch.org/tutorial-introducing-xcode-30-organizer
http://developer.apple.com/tools/subversionxcode.html
With XCode4 you can perform almost all of your SCM tasks from within the IDE itself, this is a great step forward.
Here is a link to the official guide :
http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/SCM/SCM.html#//apple_ref/doc/uid/TP40010215-CH7-SW26
Unfortunately you still have to use the Terminal command line to add a new project to SCM, this is also clearly documented in the link above.
What it does not tell you is that you also need to manually add ignore instructions to your SCM configuration otherwise you are going to end up with user settings and build outputs in your repositories. I am currently figuring out the list and I will update this answer once I have it finalised.
PS :
I know this question is quite old now but I have added this for those of you who arrive here looking for answers like I did.
PPS :
Terminal command line increases probability of human error, takes longer, is more complex and is less transparent to end users. Overall the omission of being able to add projects to SCM from within XCode is poor design, I expected better from Apple who are usually good at simplifying UI. For the command line fans out there you might feel L337 but try managing a team of programmers and being responsible for their code, command line is not your friend.
Which version control system should I use for a Rails app: Git or SVN?
Here are some factors to consider:
I'm the sole developer
I'm familiar with SVN
I've only used Git for a week, it seems pretty similar to SVN really.
I want to put my repository on a remote location and connect to it via SSH or other protocol (which I already do with SVN).
Edit: Thanks for the responses so far. It seems like Git is slightly more favoured. Does it have any SSH functionality?
I'd say go for Git. Mostly because I'm biased, but also because you don't need to setup any sort of server with Git, you just git init and go. Git is generally just better, it provides more flexibility and power than SVN does.
Edit: This is a bit of a dupe of Why is Git better than Subversion, or at least relevant.
Edit2: Git has 3 primary methods of communication, the Git protocol, SSH and HTTP. Github uses SSH for "push access", e.g., git#github.com/user/repo.git.
As a single developer who is already familar with SVN - if you want to be as productive as possible use SVN.
If on the other hand you really want to learn GIT and can afford a bit more time to learn it, use GIT.
Use Git, if for no other reason than that you can use it almost exactly like SVN (including remote management of multiple branches over SSH) and it's much, much faster and more reliable. Local checkins and branches, distributed version control, revision history management, etc. are only side benefits.
In my experience the only reasons to prefer SVN over Git are: a legacy SVN repository, or the requirement to use Windows on the client.
I would have replied in comments but I can't, yet.
For those who don't know, Git work with Windows. If you don't like the msys's version, TortoiseGit is already usable.
Since you're solo and want to put it on a remote location: SVN, but you should learn/use Git as well. You could also combine the two, use Git locally and SVN for the remote..
It's probably a good idea to use some sort of version control. It's also probably a good idea to have remote backups of your code.
Git and svn are both good version control solutions and are both popular within the Ruby/Rails community.
If you were in a distributed development group I'd suggest git might be more appropriate since one of its specific design goals was for that situation.
If you were on Windows, I'd hint that TortoiseSVN probably provides a less challenging experience than, say, msysGit.
Mostly, though they both seem to do a similar job and do it well.
If you specifically want to learn a new source control system while building your project, go for git. Or if you intend spending a lot of time in, for example, edge Rails, which lives at Github, again might as well go for git.
Otherwise I'd say you should stick to svn.
If you have a day to learn Git, then learn Git. It has all the functionality that svn has, plus cheap branching/merging, local commits, and the option of distributed development.
It is easy to work with remote repositories. If you're just looking for some kind of public hosting, then you might want to look at Github, which has free public hosting, good Ruby integration, and many pretty graphs.
I'd say there's no particular difference.
Both systems are just tools, and both of them will provide you with with the functionality you're looking for. If there's no other parameters to consider, I'd say go with SVN as you already know it and you don't need time to learn it.
I'd add one follow-up question: are you working on this alone? The GUI tool support for Git is generally lagging that of Subversion, so if that is or might become a consideration, then I would opt for Subversion.
For example, if your designers use Adobe CS4, they can use its built-in Subversion support (and you don't have to teach them Git). So consider the current and future composition of your team as a factor in your decision-making.
I used to love git, but have recently switched to mercurial. It has exactly the same syntax as git, but is written in python, and has lots of nice bells and whistles out of the box, like a web server for visual tracking of commits.
I know that this can be set up for git using gitweb for example, but it requires a bit of work.