With Xcode 9, do I need to still create a .gitignore file? - xcode9

Xcode 9 is tightly integrated with GitHub. In preferences, under Source Control settings, git tab we can now set the files to be ignored during commits.
I'd rather assumed that Xcode would use this information to create a .gitignore file as part of the process of setting a new project up to use Source Control - it does, after all, create the project and make the initial commit automatically.
Is this wishful thinking or have I missed something?
(just to be clear, I know what should go in the file)

Related

Source Control on already existing project Xcode

I've read that developers really need source control. Now I never used it before and I'm a bit lost with my existing projects.
How do I setup it?
There's already a File path inside of it, but it goes to nothing? I don't even know what it does in there.. I want a local git for my own. I found how to set it up with Terminal. But I think there should be a right way on doing this with Xcode and not with Terminal?
I'm sorry to say that Xcode does not have an option to place an existing project under version control. You can however use GitHub for Mac which will allow you to do this. It also has convenient merging tools and lets you push your code to GitHub.com if you like, all at the touch of a button: https://mac.github.com
It's easy enough to create a git repo from the command line though: open Terminal and navigate to the root folder of your project. Then type the following:
git init
git add .
git commit -m "initial commit"
Note that this approach as well as GitHub for Mac will version control every file in your project - which is not what Xcode does when you start a new project with Git enabled. You may run into trouble because your user interface state changes once every second - which can make committing and merging difficult.
The following article discusses this in detail:
http://pinkstone.co.uk/how-to-place-an-exiting-xcode-project-under-version-control-with-git-and-ignore-files-you-dont-want-to-track/

XCode Source Control File Owner

I am using XCode 4.5 and I use the build in Source control, I have modify a file and still not committed, I tried to access this file form another iMac and modify the same file and there is no problem with modifications.
The issue is how I can own this file and no other developer can modify it until I commit it?
Using git? You don't. That's not how git works, there's no concept of "file locks" and they wouldn't make sense in a distributed version control system. You'll have to actually talk to the other developers if you think it is important to avoid merge conflicts on that file.

Can Xcode ask / react to file changes outside of the IDE?

Is there are means whereby if files are altered outside of Xcode, that a warning in can be shown to ask if you want to refresh the file? This feature is available in Visual Studio, for example.
As a temporary solution, were working on source files in a Dropbox folder.
Although growl notifies us that some files has changed, Xcode doesn't know about these changes.
No, Xcode won't do that, and since there's no support for plugins you're pretty much stuck with that behavior. Some suggestions:
Create a local git repository (Xcode can do this for you when you create the project, I don't know if you can do it once it is created.
Use another IDE, like AppCode (this isn't even a solution, just came to me and I decided to add it).
With a version control system you can see the little 'M' on edited files, browse changes, etc. But since you wrote that this is a temporary solution I bet you already know this.

What are the xcuserstate files used for?

When committing changes to GIT repo, i see constant updates coming from the xcuserstate files.
What are those?
xcuserstate files are generated from within Xcode and saved in your project bundle to remember your last opened file, the open state of any group folders, open tabs, and any other user setting your project might need to remember. For purposes of revision control, you should ignore them or leave them out if at all possible.

xcode 4 not cooperating with git

I'm seeing some strange behavior with Xcode 4 and git.
Create a new project
Right click on files - choose source control then commit. Add a comment.
Choose source control then push from the file menu.
Xcode returns an error complaining about uncommitted changes?!?
Calling git status from the command line, I can see that some of the internal userdata files are not committed. Shouldn't Xcode know to either skip or include those? There is no indication in Xcode that there are any uncommitted files. The only way to find them is from the command line.
One thought would be to manually create a .gitignore file, but I would assume that Xcode handles all that internally.
Did I just stumble onto a bug, or is there some standard step that I'm missing?
Thanks!
Well, a bug is in the eyes of the beholder, isn't it. Yes, you need to Setup your git ignores for xcode.

Resources