Reputation: 732
I have to you use git for a university project. Unfortunately I had no previous experience with it and I think I kinda messed things up.
As far as I understand:
git status
lists all files that are different from what I committed and also all untracked files, that are not tracked, whatever this means.
I want to change a branch, but git wants me to delete/move a file called .DS_Store, I saw that this file is listed in my untracked files.
I've seen in other questions that there are numerous ways to delete untracked files. Unfortunately about every folder on my hard drive seems to be listed in those untracked files what seems very wrong to me.
Please explain me in a nutshell what untracked files are and more importantly if there is a way that git forgets about them. Such I'd could start from scratch.
Upvotes: 0
Views: 428
Reputation: 38189
Just create file ~/.gitignore_global
and paste there this content:
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
# Xcode
.DS_Store
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
# Pods - for those of you who use CocoaPods
Pods
Or combine those two.
I just googled "Xcode gitignore"
Upvotes: 0
Reputation: 30317
In a nutshell, untracked files are files that you haven't told git to start tracking so they are not part of the previous revision (in which case git would tell you if they have been deleted, modified, etc) and they haven't been added to the index either (in which case git would tell you they were added). If you want a number of files to not be considered for version control (there are many cases of this situation, the most common for development is: binaries that are produced from the source you are tracking under version control) then the simplest way to do it is by using .gitignore to tell git what files or directories to not care for (as an additional item I'll warn you that it works only for files that haven't been added yet to the project.... so if you want to start ignoring a file that is already part of the the last revision, you will probably have to go back in history and rewrite it so the file is not part of the history of the project).
Upvotes: 1