New files appear in red when checkout to another branch in git - xcode

It's obvious behaviour, when adding new files in a branch, then checking out to another branch, those files appear in red. But I tried to remove them and they are definitely removed when gettig back to the original branch where they were created, so it seems it's not a good idea to remove them. So how to handle that since the Xcode is throwing that stupid compiling error. Thanx.

This is not the obvious or correct behavior. Your project file is not checked into your Git repository. Some people think this is a way to avoid conflicts but it's just a way to make your project not compile.
git ls-files *.xcodeproj
Will show you if your project.pbxproj managed by Git.
You fix this by manually fixing your build settings so every thing compiles and runs then checkin your project file. You will need to do this in each branch. Your project file will not only have files that have been removed but missing files that have been added.

Related

Xcode build folder appearing in svn

I am currently working on a project which is included in a versions(svn)repository. Although I'm not sure, I think I might have changed some settings in Xcode, affecting the way the source control saves the build folder in the repository. I was told it is a bad practice to commit the build folder, and asked why have I done that, but I had no answer at the moment. A screen will elucidate this more clear:
Even if I tried to delete (or ignore) those files from the repository, they are still created after I build the project. How should I proceed in order to prevent those build folders appear in versions' project tree?
Adding versioned folder to ignore-pattern does not affect data in SVN
You must ignore and remove folder from SVN, but keep it locally
For CLI it will be svn pe ... in the parent of build folder and svn rm build --keep-local (I don't know XCode GUI's equivalents)

Xcode: changing SVN repo details

This is about outdated repo details inside XCode. The case is:
I'm reusing a supporting library from an old project in a new one.
I used "Add files to X project..." functionality to copy them to the new place.
"Automagically" the files were copied with a reference to an old SVN repo, that don't exit anymore.
So... Now I have a project with 2 repos visible, incl. one inactive. I can't commit changes to copied files, as the old repo is still linked.
Two question here:
Is there a way to edit old repo data?
Is there a way to move the copied files to the new repo, where the rest of the project is?
Ultimately I need to commit both parts ;)
Thank you.
OK. So resolving this issues required several steps to be performed. Not sure if all were required, but the eventually I got it right.
Commit all changes you can (in my case all but the folder that was linked with the old repo). Archive your projects.
Go to the root folder of your project and use svn switch --relocate command to merge repos. Details: how to change svn settings
Remove the project from XCode (via Organizer) delete the entire project folder
Remove repos in the Organizer
Fetch whatever was committed in the SVN again. Do that and create a new project. If you see any missing files highlighted in red, like my folder that couldn't be committed, delete it.
Manually add the missing files / folder that to the project, from a local copy.
Now you can commit to the repo!
Tiresome, like most things in XCode... ;)

Xcode doesn't forget deleted files after a Git checkout of an older commit

I've got Xcode (4.5) running a project stored in a git repository. In theory, I should be able to git checkout different versions of the code (from the command line) to see how things looked at various points in time.
In practice, Xcode doesn't handle the changes well. Files that are missing from older versions of the source are not forgotten by Xcode. They show up in red as if they're missing. Those files are not missing. They just didn't exist at the time the prior commit was done.
My guess is that this is happening because of something in the xcuserdata that isn't reset each time a new checkout happens. It's blocked by the .gitignore.
Any idea how I can fix this? Thanks.
Problem solved. The issue was not actually with Xcode, but with what was in the Git repository itself. Rookie mistake on my part.
For future reference, the project.pbxproj file inside of your .xcodeproj contains the list of what files are part of the project. That should be included in your Git repository to ensure that Xcode keeps up with what has changed in each revision.

Tracking everything locally but making only .c and .h changes available on github

I'm going to start tracking a project I'm working on using TortoiseGit. I have a lot of .c and .h files, and then I also have .exe, .obj, .pdb, .ilk, suo, etc. I would like to create a snapshot of everything, all those files. So that I can roll back to a prior revision if necessary. However after a few weeks I want to upload all those revisions to github but I would like people to see only the .c and .h file changes and have only those files visible in the clean public version of the project. I'm new to git and not sure how best to go about this. The closest question I found (but don't understand really) is here:
Push a branch of a git repo to a new remote (github), hiding its history
Is that what I want to do? Can someone break it down for me with a step by step that I can do using gitk (Git GUI with msysgit) or tortoisegit? My experience level is I've read the GitBook but not the advanced section yet. Thanks
I think the link to the question and the answers given for it are the way to go for this.
Another way ( which many may frown upon ) is that you can put your git repo in a git repo. This way, commit the local binaries etc. in the outter repo, but ignore them in the inner one. Also ignore .git from the inner repo in the outter repo. This will enable you to go back to some older version of the binaries and corresponding version of the source.

can't commit changes in xcode 4

i set up a project to be on version control. I imported the project without problems to the server repository. Now, when i commit changes, they seem to be committed as i don't get any errors and it says "Committing" but when i go to check the changes in the repository, i noticed that the changes are not there, so there was no commit even if xcode said it committed. Has anyone had this issue? I don't know where to look to fix it.
Thanks in advance
Not sure if this is your problem, but I would check if Xcode is using your repository or one it set up itself. Look at Repositories in the Organizer window and see if there's anything there you don't want. If there is, you'll have to remove it from that list and delete the hidden .git folder in the project's directory.
Problem fixed! The solution was to erase the project from my hard drive and do a checkout from the repository. That way subversion would know which project was under version control.

Resources