Preventing certain things from being committed in XCode - xcode

Situation: I have a few things in my code repository that I only want to be in my own working copy, but I still want to be able to modify the rest of the codebase and do commits without putting in those certain things I mentioned. Is it possible to lock those down in some way so they do not go in with the rest of my commit? Right now XCode commits everything that was modified. I realize I could commit files individually but it would be nice to continue to use the global commit.

Why not try the svn:ignore property (about half-way down the page)?

Maybe you could change the status of files to locked, then commit them without locked files.
For SVN help, pls reference to http://svnbook.red-bean.com/en/1.5/index.html.

You should comment in "global-ignores" line in the configuration file located in ~/.subversion/config.
By this way you could ignore file types that you have given. I use the following set:
global-ignores = *.o *.lo .la ## .*.rej .rej .~ ~ .# .DS_Store *.mode1v3 *.pbxuser
Hope this helps.

Related

How to enable .gitignore file in private repository in GitHub with GUI

I can't uploud a project in private repository even I'have .gitignore file(where I made a mistake, because .gitignore doesn't work). Message is that I have more than a hundred files, and simply I can't uploud it in one piece, just one by one folder or file.
I have make a new private repository in GitHub, and at the start of making it's offering to make a gitignore file, so I done that step(I chose a Visual Studio gitignore file, and then I put all files I don't need, even a whole folders I don't need from my project I've made in VS). But problem is in uplouding folders after I make the repository. Every time I try to uploud it, I get a message that I have more than a hundred files. I've even opened a whole new private repository in case git alredy tracked the files in this one. And it seems nothing is working. I have reed all official documentacion about gitignore files in GitHub, I've seen a bunch of Youtube tutorials and tryed to make a gitignore file direct in VS but also doesn't work.
Maybe it's seems funy to most of you and it is probably a banal mistake but I just can't figure this out.
SENCE I'M A TOTAL BEGINNER please can anyone tell me where I make a mistake?
Here is a piece of my .gitignore file, most of it is official code, and it is very big.
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
App_Data/
Content/
fonts/
Scripts/
*/favicon.ico
*/packages.config
I just want my whole project uploud it in one piece without unnecessary files from VS.
List item
I will augment #Harmonica141 answers by suggesting you to use on line .gitignore file generator.
After selecting desired IDE or programming language .gitignore file will be generated for you with all required regex and file exclusion.
After downloading a file you need to add it to the repository by command line.
Do as follows:
cd into/the/repository/folder
git add .gitignore
git commit -m "Added .gitignore."
git push origin
Your .gitignore is active as soon as it is tracked by git. To accomplish that, you will have to commit it. Do this first, make a commit consisting only of that file. Then git should not "see" all the files masked by it any longer.
In command line do as follows:
cd into the repository folder
git add .gitignore
git commit -m "Added .gitignore."
git status
The last statement should show you all the files that are still untracked or uncommitted but not the ones contained in the .gitignore. From there you can keep adding and committing as usual.
Don't forget to push later to have your changes up on remote.

Should XCSharedData be checked into Git Repo for Xcode project?

I just made some changes and I see a pending file that has not been added to the repo. The filenames path is */xcshareddata/IDEWorkspaceChecks.plist. Can someone explain the reason for this file and why or why not it needs to be added to the repo?
The files in xcshareddata/ should be added to the repo (but not the ones in xcuserdata/):
Xcode 9.3 adds a new IDEWorkspaceChecks.plist file to a workspace's shared data, to store the state of necessary workspace checks. Committing this file to source control will prevent unnecessary rerunning of those checks for each user opening the workspace. (37293167)
https://developer.apple.com/library/archive/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html
Regarding Xcode 9 and newer, the only line you really need in your .gitignore is:
xcuserdata/
Nothing else for Xcode 9+. Whatever other lines you have in your .gitignore should be only added for your specific needs, not because you found an obsolete .gitignore sample on the internet. :)

Committing source to git via Xcode, failure to commit

I have a repository, in which i code. Once some changes are made, they are checked in to GIT repo via Xcode.
Before checking in .. files look like this - files i have changed look right
Upon checking the code in (Alt-Command-C), all i see is (Note that files seen in explorer window are not seen)
Towards the bottom of the screen, correct number of files are shown
When commit button is hit, no errors are shown, all looks normal, however, nothing (visually) changes:
Explorer continues to show same files modified
Commit screen continues to show some files in need of being committed
Commit screen does NOT show exact files to be committed
I could have sworn that last night all files were committed. Could someone help me understand what's going on here?
UPDATE:
After modifying my .gitignore to include
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
.DS_Store
*.tm_build_errors
You should probably create a .gitignore file and put it in your directory. The xcuserstate files are constantly changing (and are of no use to your overall commits). Your will always show changes and it will also prevent you from pushing your changes to your remote (if you have one).
There are plenty of places that will show you how to make a good gitignore file.
Git ignore file for Xcode project
The issue it seems was that in my set up, Xcode defaults to File View
When I switched to Flat View, files which were changed showed up
First thing to try it to try to commit the files from the command line.
Run git status to see the state of things, git add <modified files>, and the git commit - you should either see an error or files will be committed.

xcode commit missing file or directory

I'm not sure what happen but when I try to commit my changes in Xcode I get an
fatal: Could not switch to '/Users/charlesbutler/xCode/MA Mobile/MA MobileTests': No such file or directory
I have a bunch of files like this.
Is there anything I can do to remove them from being committed. A lot of them were deleted (probably manually in the project folder by me)
This just happened to me. I had deleted a folder with contents from the project folder. Xcode didn't handle that well.
What worked to fix it was to recreate an empty folder with the same name. No need to recreate its contents.
In your case I think you just need to create a new empty "MA Mobile" folder in the same location the old one was. Then commit. It worked for me.
After the first commit I deleted the new folder, then committed again. It seems that Xcode is missing the logic to handle the deletion of a whole folder with contents.
If you'd like to simply commit all changes you made, doing so through the Terminal should fix the problem.
Open the Terminal App and cd into your project directory, once there type in the following command:
git commit -a
Enter your commit message by pressing 'i' and typing it in, then press 'Esc', then ':', and type 'wq'
All done, you're problem should be fixed.
Jader Feijo's answer solve my problem.
Just want to suggest an easier way to add comment, without all this additional Vi steps, by simply adding -m parameter:
git commit -a -m "Commit Message"
Assuming that you are using GIT - run the following in your command line;
cd "/Users/charlesbutler/xCode/MA Mobile"
git rm -r "MA MobileTests"
I had this problem after adding and then deleting sub-projects in a project that was under source control.
I fixed it by using the GitX application, selecting the Commit View, un-staging the now non existent files from the Staged Changes list, and then selecting Discard Changes for the same files in the Unstaged Changes list.
I then had to delete the repository from the Xcode Organiser-Repositories screen and restart Xcode before things were working ok again. Xcode automatically re-adds the repository back in when the project is re-opened.
Perhaps someone with GIT expertise can provide a command line alternative that performs a "Discard all changes that are no longer present on disk" action
I've had this problem because somehow a folder of the project was added to .gitignore, I removed it from there and committed the missing files. Xcode did not show me that the folder was in gitignore or that he was different from the other folders in any way.

How do I keep Resharper Files out of SVN?

I am using VS2008 and Resharper. Resharper creates a directory _Resharper.ProjectName. These files provide no value for source control that I am aware of and cause issues when committing changes. How can I get SVN to ignore them? I am using TortoiseSVN as my interface for SVN.
EDIT: You guys are fast.
Here's a link to show the ignoring process in TortoiseSVN
Add the file names (or even the pattern _Resharper.*) to the svn:ignore property for its parent directory.
Gonna post an answer to my own question here as I read the manual after I typed this up. In TortoiseSVN, goto settings. Add
*ReSharper*
to the "Global ignore pattern". Adding items to the global ignore pattern means that these files will be ignored for any project you work on for the client with TortoiseSVN installed, so it might not be appropriate to use the global ignore in all cases.
You can also add specific files and directories to the ignore list for individual projects if you select this from the TortoiseSVN menu BEFORE they have been added to your repository. The "BEFORE" part is what tripped me up originally. Since this is a single developer project, I've been checking in binaries, etc. b/c it has no consequence for other developers, and the Resharper files got in there.
Store Resharper caches in system temp folder.
Check First setting page in r#.
Environment -> General -> System -> Store caches ..
Short answer: the "svn:ignore" property
Long answer:
# cd /your/working/copy
# export EDITOR=vi
# svn propedit svn:ignore .
(add "_Resharper.ProjectName" on its own line and write the file out)
Edit: erg... doh, just realized you said tortoise... this is how you do it with the command-line version of SVN
svn has an "ignore" property you can attach to a filename pattern or a directory. Files and directories that are ignored won't be reported in "svn st" commands and won't go into the repo.
Example: you have C source code in .c and .h files, but the compiler creates a bunch of .o files that you don't want subversion to bother telling you about. You can use Subversion's properties feature to tell it to ignore these.
For a few files in one checked-out working directory, for example myproject/mysource/
bash> svn propedit svn:ignore mysource
In the text editor that pops up (in linux, probably vi or whatever your EDITOR env var is set to), add one filename pattern per line. Do not put a trailing space after the pattern (this confuses svn).
*.o
*.bak
That's all. You may want to do a commit right away, since sometimes svn gets fussy about users making too many different kinds of changes to files between commits. (my rule is: if in doubt, commit. It's cheap)
For a type of file appearing in many places in a sprawling directory tree, edit the subversion config file kept inside the repository. This requires the repository administrator's action, unless you have direct access to the repository (not through svn: or http: or file:, but can 'cd' to the repository location and 'ls' its files). The svn books should have the details; i don't recall offhand right now.
Since i don't use Tortoise, i don't know how directly the description above translates - but that's why we have editable answers (joy!)
This blog post provides a example on how to do what you want on via command line svn.
http://sdesmedt.wordpress.com/2006/12/10/how-to-make-subversion-ignore-files-and-folders/
These change will be reflected in TortoiseSVN.
I believe there is a way to do it via tortoise however i don't have a windows vm accessible atm, sorry :(
SVN only controls what you put into it when creating your repository. Don't just import your entire project folder but import a "clean" folder BEFORE doing a build. After the build you get all the object files or your _Resharper folder etc. but they are not version controlled.
I forgot: the svn:ignore command is another possibility to tell SVN to exclude certain files. You can add this as a property to the version controlled folders, e.g. with TortoiseSVN.

Resources