I pushed my code to repository, I can see the MyProject.xcdatamodel/contents file in bitbucket along with other files. But when pulling the repository, all files are added except the coredata file MyProject.xcdatamodel/contents. Am I versioning the right coredata files? Thanx.
EDIT:
here is my gitignore file:
.DS_Store
*.swp
*.lock
profile
DerivedData/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
# NB: also, whitelist the default ones, some projects need to use these
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
*.xcuserdata
!xcshareddata
!xcschemes
*.moved-aside
*.xcodeproj
.xcworkspace
Ignoring files
From time to time there are files you don't want git to track. There are a few methods of telling git what files to ignore.
If you create a file in your repository named .gitignore git will use its rules when looking at files to commit. Note that git will not ignore a file that was already tracked before a rule was added to this file to ignore it. In such a case the file must be un-tracked, usually with git rm --cached filename
This file can be committed into the repository, thus sharing the rule list with any other users that clone the repository.
Note that you can create a .gitignore in any subpath to have its rules applied at that path. Sometimes an empty .gitignore file is used as a placeholder for an empty path, for example to force git to generate a log/ path for your development environment to use.
Example .gitignore file
*.exe
*.dcu
*.dres
*.local
*.identcache
__history/*
Win32/*
Win64/*
As standard, I'd setup the ignore file as:
xcuserdata
project.xcworkspace
.DS_Store
And add from there as required.
Not sure why you'd want to add *.xcodeproj into your ignore file. This is the main repository of project information. Whenever you add files the the project (like adding a model version) you want the change to be recorded in the project...
There are some things inside the xcodeproj file (it's really a folder) that you can ignore, but you shouldn't ignore the whole thing.
Related
I made a Rails application.
Do i need to push these files to Github?
.browserslistrc
.gitattributes
.rspec
.ruby-version
The short answers are "if you want", and "there's no reason not to".
All of these files do something to make it easier to replicate your code base and setup on another machine. None of them contain secrets that shouldn't be shared.
.browserslistrc
The config to share target browsers and Node.js versions between different front-end tools.
.gitattributes
a simple text file that gives attributes to pathnames.
These attributes affect how the contents stored in the repository are copied to the working tree files when commands such as git switch, git checkout and git merge run. They also affect how Git stores the contents you prepare in the working tree in the repository upon git add and git commit.
.rspec
Read command line configuration options from files
.ruby-version
Many Ruby (or Rails) projects will include a simple .ruby-version file, which simply specifies a version number
I am using git with Xcode but when i commit files using Xcode (not command line) after committing and pushing to remote, when i use git status this is the result.
What are Untracked Files. What should i do with them?
And what about Changes not staged for commit part? What are they?
These untracked files are files that have been added to your directory structure (e.g. it would appear that you did a pod install), but you have neither added them to source control nor told git to ignore them. (I would tell git to ignore them, personally.)
But you have to decide whether you want to add the Pods directory to your repo or whether you'd like to ignore them. See https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control. (I personally don't put Pods into source control, just the Podfile and Podfile.lock. There are many opinions on that topic, though.)
Re the .DS_Store, we often have a ~/.gitignore_global that tells it to ignore those, too. Once you tell it to ignore these, they will be removed from the “untracked” files list. See .gitignore all the .DS_Store files in every folder and subfolder.
Re the unstaged .DS_Store it looks like your repo already had that one .DS_Store in the repo. I would suggest removing it from the repo. See How can I Remove .DS_Store files from a Git repository?.
In short, it looks like you have a project with no .gitignore file (or it is missing entries). It also looks like you don’t have a ~/.gitignore_global to ignore .DS_Store files.
For an example of a .gitignore that you might use for Swift projects, see https://github.com/github/gitignore/blob/master/Swift.gitignore (though, like I said, I generally would uncomment the Pods from that particular .gitignore).
I had not heard of this file until I randomly checked git status in an old repository and there it was, a file I had not edited myself nor ever seen before. I do not know how it got there.
It seems it's common asked about - mostly how to remove it (e.g. here and here).
What is this file, and what created it?
.idea is the dir for saving the project configurations for all Jetbrains IDES (RubyMine , Pycharm , PHPStorm , WebStorm ..etc)
you can handle it using two ways if you don't want to commit it to the repo
Ignore it only for yourself
in .git/info/exclude
add /.idea
Ignore it in .gitignore so it will be ignored for everyone who uses the repo
by adding /.idea to .gitignore
if the dir .idea already tracked by git you will need to remove it first from the cached files before ignoring by git rm -r --cached .idea
This folder can include important configuration if you did any custom configuration for the project and also include the indexed data for the IDE which helps it to provide quick autocomplete and in certain cases would be better to commit it to the repo but I always ignore it because the other developers in the team don't use RubyMinee
I have made a naive mistake while setting up my project. We are 3 developers working on one remote repository. While setting up git we never thought that Xcode would produce non-development files and push them to our remote repo. Now once I learnt after crash and burn I made a .gitignore file.
.gitignore looks like this, please do let me know if I should edit this too. (File credit goes too : This question's answer given by Abizem)
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
But now question is there any possibilities that I can untrack all of those listed files from our source control?
or
Can I list all tracked files with their path and later I know a painful way to remove one by one with,
git rm --cached 'file path'
Something I've done a few times in these situations, is move all of the files in the repository somewhere else on the filesystem (except .gitignore), then run:
git add --all
git commit -m "Remove all files"
Then add your files back in and run the following:
git add --all
git commit -m "Re-add files"
This second add & commit will adhere to your gitignore file.
I want to remove/igonre/hide whichever is better .rb~ and .# files such as .#admin.rb.1.2 from the git repository.
How I can do this?
Currently I am doing it in following way:
git rm -r "/app/models/.#admin.rb.1.2"
which removes the files one by one. Then I commit.
I also created a .gitignore file with the following values which I found for Rails:
.bundle
db/*.sqlite3*
log/*.log
*.log
/tmp/
doc/
*.swp
*~
.project
.DS_Store
But it is not ignoring the files which are already present in the directory.
Will this file ignore .rb~ backup files?
What should I do so that it will remove all the files which match the expression written in .gitignore files?
Files which are already in git will not be ignored anymore. First you have to remove them all and then the .gitignore file is going to ignore the new ones.