Xcode repository indicators meanings - ios

I wonder what these shortcuts mean and since I already can figure out that "shortcut" is not the right word for it, I don't even know what to google so I'll just strike a question here.
Here's the screenshot:
So, what does M, A, ? and all other shortcuts mean exactly ?

From this SO question:
U: Working file was updated
G: Changes on the repo were automatically merged into the working copy
M: Working copy is modified
C: This file conflicts with the version in the repo
?: This file is not under version control
!: This file is under version control but is missing or incomplete
A: This file will be added to version control (after commit)
A+: This file will be moved (after commit)
D: This file will be deleted (after commit)
S: This signifies that the file or directory has been switched from the path of the rest of the working copy (using svn switch) to a branch
I: Ignored
X: External definition
~: Type changed
R: Item has been replaced in your working copy. This means the file was scheduled for deletion, and then a new file with the same name was scheduled for addition in its place.
L : Item is locked
E: Item existed, as it would have been created, by an svn update.
Note that these are SVN status codes and some of them do NOT apply to XCode as #Zaph pointed in comments. Anyway I think most used are included in this link and are valid in xCode too.

Maybe you ended up here because you merged two branches together in Xcode and got a bunch of exclamation marks (!) as a result and wonder what they mean, what the actual problem is, and how you get rid of them? If so, do the following:
Navigate to your projects folder and open it in Terminal (easiest by dragging the folder to the Terminal app icon).
Type git push.
Restart Xcode.
(You may get a warning in 2 if you have uncommitted changes, in that's case just type git commit -m "Your commit comment" and then type git push again.)
The problem here is just a miscommunication between Xcode and the Git repository, and Xcode probably can't work out whether the marked files have been pushed or not.
Generally, my experience is that for all inexplicable problems with the source control in Xcode (missing files, not under source control warnings etc) it's best to handle them directly in the project folder with Terminal. Start by typing git status and you'll (mostly) get a quite clear explanation of what's the problem and how to solve it.
Good luck!

These are code version repository indicators.
M - modified file.
A - added file.
? - untracked file.

There are Xcode Source Control management codes, they provide the file status as below:
' ' (Blank) Unmodified
'M' Locally modified
'U' Updated in repository
'A' Locally added
'D' Locally deleted
'I' Ignored
'R' Replaced in the repository
'-' The contents of the folder have mixed status; display the contents to see individual status
'?' Not under source control
Status codes From section Store and Track Changes with Source Control of Apple's Xcode documantation.

It's the modification status of the file : M is for Modified and A is for Added

Related

Xcode : Some image assets appear Unassigned after git clone

As usual I've commited my Xcode project with Xcode Source Control interface. Then, when I clone the project, for a unknown reason, some images from the Assets.xcassets folder appear with a warning showing Unassigned. See attached screenshot :
If I drag the Unassigned image to 1x, the warning disappear. But I have to do this with each concerned image, and each time I clone the project.
What is weird is that the image get correctly commited (as I can reassign it), but the asset seems messed up.
Does anyone has an idea of what can be the root cause of this ? Using Xcode 9.3.
I had a same issues whenever after git pull or clone.
I assume it is a Xcode bug vulnerable reading special characters other than Enligh characters.
Mine fixed after changing image filename to english characters only without any special characters(other than English characters) included.
Try fixing your asset file name to something else using just english characters.
I see your assets filename contains some special characters.
I'm using the source control integration in Xcode since version 6 and today in Xcode 9.3 is more easy to use if you have nice configured, for example in my project there are three programmers and one use sourceTree, other use the command line and me xcode to send commits everyday and resolve conflicts with the files or merges, your issue is not related with the GUI or git operations.
You need to delete these files Unassigned, just click and press the button delete in your keyboard and remove all references so you can do clean and add again the file reference and assign, after you can do build and make a new commit using xcode and send the changes.

I want to restore my project in my yesterday file in Xcode, how can i do that?

I am a beginner in the iOS development, Now i am trying to debug my code
As we know, Xcode is autosaving. I am debugging a chunk of code right now, But i am messed up, somehow it didn't work properly, I have tried using control + Z to get back, but it still didn't work.
I want to back to my yesterday Xcode project file, but the problem is, i have not made any backup, and i have not made local repository. Can get my previous version file back?
does it work if i use git reset ?
git reset
You should use Github for saving your project by committing daily updates
OR
You can recover some of files using TextEdit
By using TextEdit App you can view and restore past versions of documents.
Step 1:
Open your document file using TextEdit.
Step 2:
TextEdit ->File->Revert To->Browse All Version
Stpe: 3:
Select files from old dates whichever you want & click restore.
Apple Guide
I'm afraid there no way to go back. No repo, no CRT+Zm no copies? I dont see any option.
PD: Create a local repot
'git reset' will not work for you. You should have setup a Git repository with timely commits. Create a git repo now so that you will not face the same situation later.

Xcode 7.3 Source control issue for files

I've pushed code on local server manually. Thereafter taken checkout of project using CornerStone.
However, the project contains few file with different versioning states i.e A, M and A+.
But project in CornerStone dosen't shows any of these versioning states.
I tried to fix it by committing files (showed commit success) but it remained same.
I'm worried since this will create confusion at later stage.
How to fix this?

iOS - Distributed applications plist

I'm using git with an iPad xcode project.
I have an application settings plist file (AppSettings.plist) that is included in the projects repo.
I'd like my devs to have this starting AppSettings.plist when they do a fresh clone but I wouldn't like this file to be committed each time it's updated, so each dev can keep their own version.
I though about .gitignoring it and supply an AppSettings.plist.dist but how could we remember the builder guy to update this file each time we want to have him to ?
So you do not just want a static template of the file, but you also want to modify the file and get these modifications merged into the working copy?
Note: Let’s call AppSettings.plist “working copy” and AppSettings.plist.dist “Template”
My proposal would be to add a version number to the file. When you do changes in the repo, you increase the version number. Then when building you check these numbers in the working copy and the template and emit an error if they don’t match.
If you don’t care about newer/older, you can also use git’s ident feature. That will add the blob id of the template to on checkout. If that id is not the same in the working copy, it is obviously not based on that template.

How to use Git properly with Xcode?

I have been an iphone developer for a while, and I have recently been including git in my workflow. I have used git settings found on http://shanesbrain.net/2008/7/9/using-xcode-with-git for my workflow so far.
Those settings tell git to exclude *.pbxproj from merges? Is there a real reason for doing this? For example, when I add a file to the project and push to origin, my fellow developers will not have that file added to their xcode project when they pull. Then if one of them builds a release this file may not be included. Shouldn't I just let git handle the merges for the project file? Why or why not this file should be in merges and how to properly handle the situation when files are added to the project?
I have worked on iPhone applications full time since the SDK launch, most of that time spent working on teams with multiple developers.
The truth is that it's way more harmful to disallow merging of that .pbxproj file than it is helpful. As you say, when you add a file unless other people get that file, they have to also add it to their project - in an application of any size, that sucks and it also takes away a huge benefit of source code control in that you cannot really revert to a complete earlier project state just through git.
The .pbxproj file is simply a property list (similar to XML). From experience, just about the ONLY merge conflict you were ever get is if two people have added files at the same time. The solution in 99% of the merge conflict cases is to keep both sides of the merge, which for git at least simply involves removing any >>>>, <<<<, and ==== lines. In fact this is so common that I have created a simple shell script to fix a .pbxproj file in a merge state from git, I run this from within the project directory (at the Classes level):
#!/bin/sh
projectfile=`find -d . -name 'project.pbxproj'`
projectdir=`echo *.xcodeproj`
projectfile="${projectdir}/project.pbxproj"
tempfile="${projectdir}/project.pbxproj.out"
savefile="${projectdir}/project.pbxproj.mergesave"
cat $projectfile | grep -v "<<<<<<< HEAD" | grep -v "=======" | grep -v "^>>>>>>> " > $tempfile
cp $projectfile $savefile
mv $tempfile $projectfile
Worst case if it fails (you ask XCode to load the project and it fails to load), you simply delete the .pbxproj file, check out the master from git, and re-add your files. But I've never had that happen in many months of use with this script, again working full time on iPhone applications with several other developers.
Another option (pointed out in comments below) that you can try using in place of the script, is to add this line to a .gitattributes file:
*.pbxproj text -crlf -diff -merge=union
Then git will always take both sides of a merge for the .pbxproject files, having the same effect as the script I provided only without any extra work.
Lastly, here is my complete .gitignore file, showing what I do have it set to ignore as there are a few things you don't want - in my case really just emacs remnants and the whole build directory:
# xcode noise
build/*
*.pbxuser
*.mode1v3
*~
# old skool
.svn
# osx noise
.DS_Store
profile
This works for me in Xcode 4.6 and Git 1.7.5.
Add and commit .gitattributes file with this:
*.pbxproj binary merge=union
I've tested this with another team member and works great.
Taken from:
http://robots.thoughtbot.com/post/33796217972/xcode-and-git-bridging-the-gap
Frankly, the existing answers are misleading.
If you never delete or rename files, then using the merge=union strategy, which just combines the differences in different commits directly, is a good idea.
However, in the real world, we do need to delete or rename files sometimes. Merging the differences without any modification would make a lot of problems under these situations, and these problems usually lead to the "Workspace Integrity - Couldn't load project" issue, which makes you even not able to run the project.
The best solution I got so far:
1) Design the project well and add all the needed files at the beginning, so you would seldom need to change the project.pbxproj.
2) Make your features tiny. Don't do too many things in a branch.
3) For any reason, if you need to modify the file structure and get conflicts in project.pbxproj, use your favorite text editor to solve them manually. As you make your tasks tiny, the conflicts might be easy to solve.
The short answer is that even if you don't include that line in .gitattributes, you may not be able to easily merge two modified versions of a .pbxproj. It's better for git to treat it as a binary.
See here for details: Git and pbxproj
Update: Even though the git book still agrees with this answer, I no longer do. I version control my .pbxproj just like any other non-binary source file.
I did create a Python script that can handle merge conflicts in XCode Project files.
If you want to try it, you can check it out here: https://github.com/simonwagner/mergepbx
You will have to install it as a merge driver, so it gets called automatically when you have a merge conflict in your project file (the README.md will tell you how to do that).
It should work much better than using merge=union as mergepbx understands the semantics of your project file and therefore will resolve the conflict correctly.
However the project is still alpha, don't expect it to understand every project file that is out there.

Resources