Finally, Apple introduced native Git support in Xcode 4. Git is now the standard version control system you can use within Xcode. The Apple engineers did a great job in integrating Git into Xcode 4 … but there is room for improvements 😉 Tools like gitx still are essential for me to keep track of all the branches in the Git-repository.
If you want to use Git as the version control system for your Xcode projects, you definitely should use a specific .gitignore file to keep your Git-repository clean.
That’s the content of a Xcode4 optimized .gitignore text-file:
# Exclude the build directory build/* # Exclude temp nibs and swap files *~.nib *.swp # Exclude OS X folder attributes .DS_Store # Exclude user-specific XCode 3 and 4 files *.mode1 *.mode1v3 *.mode2v3 *.perspective *.perspectivev3 *.pbxuser xcuserdata
Good work, thanks.
Where does the .gitignore reside? In the .git/ or above with project files?
You just put the .gitignore file in the project directory with all the project files.
Hope this helps.
one can also specify a global gitignore file in ~/.gitconfig:
excludesfile = /Users/username/.gitignore
I disagree with the blanket exclusion of Xcode workspace files from git. These are very important in many development projects and necessary especially when linking against static libraries. Be careful excluding them from your repo as others may have a tough time building without them.
You’re absolutely right … in times of CocoaPods including workspaces is essential! So I just update the article and removed *.xcworkspace from the .gitignore file!