Commit to git after switching to workspace and adding CocoaPods library - cocoapods

I'm a Cocoapods newbie, so I have a basic question.
After adding cocoa pods to my project, a workspace file is generated, and from now on I must to use this file to open and work on the project.
Currently my project is stored in an Git.
To enable my working partners to work with me on the project, I need to commit the .workspace file so they to can open and work on the project too. But unfortunately, after creating the workspace by the cocoa pods, my Git client (Source tree) doesn't recognise the .workspace file as a added file.
Is there something I'm missing? Do have to commit my .workspace file in order to enable my code partners to work on the project with the Cocoapods added library? or maybe its a Xcode setup in order for the Git to recognise the new workspace?
any assistance would be greatly appreciated

Did you try?
git add --all
git commit
And then checking if the file was added???

Related

Xcode - Hiding .xcodeproj on files on GitHub repo via .gitignore

I am using Xcode to as my IDE for coding questions that I publish and commit to my GitHub account. However, I don't want the ProjectName.xcodeproj to be shown in the repo. Is this possible?
Also, how do you suggest managing .gitignore files in Xcode? The only solution I have come across is managing it manually via terminal.
I've tried creating a .gitignore file via gitignore.io and then going into the project directory via terminal and using curl http://gitignore.io/api/c++,xcode > .gitignore. This has no effect whatsoever.
This has no effect whatsoever.
This would have no effect if the files listed by the .gitignored are already tracked.
Try (now that you have a .gitignore in place) git rm --cached -- ProjectName.xcodeproj, and then see if that file is still in XCode Git status.
Commit and push: that file won't be in the repository anymore.

Trying to commit XCode project to Github, but Github sees legit source tree as submodule

I'm trying to archive an XCode source tree in Github. Here's my current process for doing so:
Go to Github and create the private repository that will contain the code. Tell Github that it's an Objective-C application (so it creates the right .gitignore file).
git clone github#github.com:example-org/xcode-repo
cd xcode-repo
unzip ~/xcode-project.zip
git add .
git commit -m 'initial archival import'
git push
Visit github.com for the repository.
Observe that the directory created by the unzip command now appears as a submodule.
I observe that the subdirectory referenced above does not contain a subordinate .git directory. I can't find any signal when searching for this on Google, Bing, or Stack Overflow. Anyone experience this before, and if so, what did you do to resolve the issue?
Thanks for any help folks can offer.
UPDATE: I thought I'd mentioned this earlier, but I either erased it for some reason, or just plain forgot. Apologies for my oversight! I am on a Linux computer, attempting to archive source code developed before I arrived on this project.
It's easier if you reverse the process. Instead of creating a repository in GitHub and cloning it, create your Xcode project first. When you create the project, there's a checkbox to create a local git repository.
Select that checkbox. After creating the project, put the project on GitHub.
If you're using Xcode 9, you can add your Xcode project to GitHub without leaving Xcode. Go to the source control navigator, select the Remotes folder, right-click, and choose Create Remote on GitHub. You can see screenshots and more detailed information in the following Stack Overflow question:
How to connect Xcode 9 and GitHub?
And the following article:
Xcode 9: Adding Your Project to GitHub
UPDATE
Since you're not on a Mac and don't have access to Xcode, you would be better off starting with Step 4. Unzip the Xcode project. Call git init to create a local repository for the Xcode project. Then go to GitHub, create the remote repository, and follow the instructions GitHub gives you to get the local repository on GitHub.

add Xcode target in git repository

I am working on an iOS project.
I have checked source control support (git) at project creation.
I have add a target for apple watch. In fact Xcode created 2 targets: watch app and watch app extension.
My problem is i was supposed to see a letter (A) in project tree but i do not see nothing next to new files.
How can i add those new folders and files in git ?
Thanks
git add -A
This command will add all new changes in the current repository. To run it just open Terminal and go to your Xcode project folder and type it in. You can then see the added changes with git status

Why doesn't Xcode create a .gitignore file?

I'm aware of how to create one and there are lots of posts of what should be in them for an Xcode project. This is a more basic question.
When creating a new Xcode project with the git option why doesn't Xcode create a default .gitignore file?
Assume that I'm just working locally, I haven't created any remotes.
If I don't add a .gitignore myself does that mean that the files that are usually added to a .gitignore (like .DS_Store and *.xcuserdatad for example) are being managed by git? Is this bad?
Or is Xcode doing something behind the scenes to ignore those files?
I'm pretty sure that Xcode does not create a gitignore file on its own. So this is how I start a new project now.
Create a new project in Xcode. Do not create a local git repo. The problem with getting Xcode to create the repo is that it performs an initial commit before a gitignore file is created. I prefer to add gitignore before the initial commit.
Close the project.
In Terminal, navigate to the directory containing the
new project.
git init
curl https://www.gitignore.io/api/xcode > .gitignore There are lots of places to get gitignore files but this is super handy as shown on NSScreencast episode 156.
git add . Be sure to include the dot, that adds everything.
git commit -m “Initial commit."
Open the project in Xcode and inspect the Source Control menu. If you select History you should see the initial commit.
Update:
www.gitignore.io now redirects to www.toptal.com/developers/gitignore
It's nice. You can specify keywords like xcode, cocoapods, etc.

Convert Xcode project to New Xcode 4 with Git and enable .gitignore?

I'm sort of stumbling around with an issue with Xcode 4, and Git. I'm a one man shop with multiple macs, and had my project working with Git and Xcode4, (stored on a dropbox folder), so I could share that folder across my MBP and iMac with minimal interaction. So, it was late one night and I accidentally committed my xcode project file, and then I started getting issues with UserInterfaceState.xuserstate constantly updating... Later learned that .gitignore would have been good to have in place.
Back to the drawing board and I've been trying to take the new (old) project and enable git on it with the following:
$cd path/to/project
$git init
$git add .
$git commit -m "Initial commit of project"
This works fine, now I'm back in XCODE, and add the repository, which it recognizes in Organizer. One Issue is XCODE doesn't recognize that I've modified a file, and the majority of the "Source Control" menu items are disabled, Ex: "Commit"
I'm wondering if there are a recommended # of steps to:
1) Get Git running on a xcode project that wasn't set up this way initially
2) Steps to add the Gitignore file and when
Ultimately would like the "Source Control" menu items enabled again.
I'm obviously learning some Git SCM related items with xcode 4, and I appreciate your feedback!
Maybe this isn't the answer you want but I gave up on getting Xcode4 to play well with git and just started using the excellent (and free) SourceTree. It really made my life easier.
To add Git to the project
Go to the directory and in a terminal window
cat > .gitignore
build/*
*.pbxuser
*.perspectivev3
*.mode1v3
javascripts/phonegap.*.js
Type Ctrl+D to close the file.
Initialize the Git repository
git init
git add .
git commit -m
Add the repository in organizer. Use the full directory path.
Caveat - this still does not enable Source Control menu items. But you can use git from the command line.
See other related post: Using Git with an existing XCode project
There are three ways of setting up exclude files in git. Which is easiest depends on you. But, I find that when using git to share for myself amongst multiple machines, a global ignore file works best, and I can always add more specific excludes if you need to.
Essentially
Globally, by setting up a per user or per machine exclude file
Per repository - by setting up a .gitignore file in the repo
Per clone - by setting up the `.git/info/excludes file
I've got a my global exclude file on Github if you want to see an example, including Xcode4 specific exclusions.

Resources