'.pbxproj' file is missing in commits list - ios

currently building a project clone and push all the changes to my github account step by step.
And i always used to see 'Twitter.xcodeproj/project.pbxproj' checked together with modified .swift files.
However, i don't see it now. I've reopened and did some additional changes to the code, but still nothing.
Is that ok, if it's not pushed?
And how do i get it back to normal if it's not?

The list you are looking at is generated by git status. Well, git status does not include any files that didn't change. So you should not expect to see project.pbxproj in the list unless you did something that would change it (like making a new code file and adding it to your project). Merely editing your existing code wouldn't change it, so it doesn't appear.
(In a way, this is a case of the classic confusion as to what git status means. Beginners often think that it's a list of your files, or a list of the files that will go into this commit. It isn't. A commit always contains all your files. But git doesn't bother to list them in the git status, because that could be an unnecessarily huge list. There are ways to find out what's in the commit, but the screen you are displaying is not how to do it.)
TL;DR Don't worry, be happy.

Related

After checking git diff, how can I ignore changes in a few files that I dont want to add to this commit?

Consider I have made some changes in a few files or classes.
FYI: I am an iOS Developer and use XCODE for development.
Now, After checking git diff from terminal, there are a few changes that I want to ignore and not add to the commit that I am about to make. How can I ignore changes in a few files that I dont want to add to the commit? And also, how to make sure that in future commits, it should not get added.
Thanks in advance...
There are two things you need to know about here:
First, how to ignore certain files permanently, even for future changes. This is typically done for files that are auto generated by your code, such as build files, or local settings (a swap file for vim for example). For this, you need to add the file patterns in a .gitignore file at the root of the repo directory. Read more on it here.
Second, how to ignore certain files for the following commit only. For this you can either hand pick the files you want to add by doing git add <file_name>, then the commit will only have these files, or you could stash your changes to the unwanted files, add all files, commit, then unstash. Read more on stashing here.
If these are files that you will never want to commit, then the answer is to use a .gitignore on your repo with the file patterns you want to ignore.
If you have, in the same file, some changes that you want to commit, and some that you don't, then you can do interactive staging. You start it with git add -i and typing p you select the patch option, git will ask you which file do you want to commit partially, you select the file and then git you show you every hunk of changes you made in the file and you select if you want to stage that hunk or not.
If you can use git-gui or another gui this process can be even simpler.

check out TFS at a specific change set

I'm using TFS and VS 2012 and my project is in a broken state and I can't figure out why. I'd like to go back to a previous version of my solution when I know it worked and make changes on that working version. However, when I choose to check out a specific changeset, it seems to me like it's only changing the files that were changed in that changeset. When I use git and check out a revision, my code looks exactly like it did at that revision. Files that didn't yet exist at that revision are removed, files that did exist have contents as they were at that revision, etc. But I can't seem to do the same in TFS. I can't figure out how to get all of the files (and only the files) in the state that they existed when a particular changeset was checked in. Am I missing something? Any help REALLY appreciated.
Try using the Advanced option when you right click on a solution or folder in Source Control:
Then when the dialog appears, check both check boxes so the version you have is overwritten with the specific version you want by selecting Changeset from the ddl and entering the changeset you are after...
This should overwrite the existing solution files with the specific version.
If you have trouble doing it over top of existing files, delete the source on your local machine first and get the specific version after that.
A changeset is just the files checked in at one time, not a snapshot of the whole system. You want to use labels for that. A label will mark all the files in their present state, just as you describe Git doing.
Find the changeset you want and "Get This Version" to only get the changed files.
Manually check out each file for edit in Source Control Explorer to match the changeset.
Now the previous changeset's edits can be checked in.
NOTE: This is MUCH quicker than getting the entire repo using "Get Specific Version."

Remove git history for distributing project for bug report?

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

pull changes from branch when deleting files

I can't figure out the best way to do this and it has happened a few times where I mess myself up that it'd be nice to know a possible good way for this. On master, I have our main project. We finally got approved to use ARC in iOS and I created a new branch for that to not mess with the main working master branch. I also took the time to delete some unneeded files in my ARCBranch. What I want to do is use this branch for development for the next release. I'd like to pull in the changes from master to the ARCBranch. So I switched to ARCBranch, and did
git pull origin master
I got conflicts, some which were straightforward because I could see the code, others being changes in the pbxproj file where I cannot tell what's what. I did see
<<< HEAD ==== >>>. I can't tell what I need to do here. I can't open it in Xcode, only a text editor. I tried just deleting those <<< === >>> characters since I saw one person on SO say that you typically want both changes and that you could always do that. This didn't work for me. I was wondering if there is a better way to do this change. Maybe somewhere where I can see each change by change happen? Thanks.
Instead, you could try
git rebase master
This would apply the changes commit by commit. If there are conflicts, it would stop there, so that you can resolve them and do
git rebase --continue
to finish applying all the patches.
It failed to auto merge so it marks the conflicting blocks of code and leaves them both so you can decide and remove one yourself.

Viewing the contents of previous commits in Xcode

In Xcode when I go to Organizer -> Repositories I can see the list of
all the commits I've made sorted by dates.
For any commit, I can expand the viewing area by clicking the disclosure triangle to the
left.
This shows me the list of file that were
added/modified/deleted in that commit.
I can click any file in his
view to open the versions editor and view the diferences from my
working copy.
Now here's what I'd like to do: I'd like to do is view the contents of files that I deleted in this commit. Is there a way I can view them from within Xcode? It looks like one can only see which files were modified and what those modifications were. There seems to be no way to view contents of deleted files.
Can someone prove me wrong?
I don't know GIT, for Subversion the situation is as follows.
Deleted files are handled differently in Subversion and thus most clients have trouble getting information about them, so does XCode. The only way I see is to use the command line. You need to know at which revision the file was deleted. Let's say this number is 101, so at 100 it existed yet.
Open a terminal and type:
svn log https://myserver/myrepos/mypath/DeletedFile.m#100
svn cat https://myserver/myrepos/mypath/DeletedFile.m#100
You can even perform diffs. To compare revisions 85 and 90:
svn diff -r 85:90 https://myserver/myrepos/mypath/DeletedFile.m#100

Resources