tags:

views:

36

answers:

1

I am new to Git, and this is my first project using Git rather than SVN as my source control. I am working in XCode on an iPhone project. I want Git to ignore the build directory, which is in the root folder of the XCode project. I've found several other questions here and also found articles on google that provide examples on how to create the .gitignore file in the root directory and then add it to the Git repository to get the directory to be ignored.

Here are the steps I'm taking when setting up the repository:

  1. Open Terminal and navigate to the root directory of the application
  2. Call git init to initialize the repository
  3. Call git add .gitignore to add the gitignore file
  4. Call git commit -m to commit the gitignore file
  5. Call git status to view the status of the repository

At this point, all of the other directories and files listed in my gitignore file are properly ignored except the build directory. Here is what my gitignore file looks like:

build/
.DS_Store
**/*.pbxuser
*.mode2v3
*.mode1v3
**/*.perspectivev*

I have tried ignoring the build directory using the following different entries with no success:

  • build
  • build/
  • build/*

Anyone know what I'm doing wrong here?

+1  A: 

build/ or build/* should be enough to ignore the directory.

The only reasons it could be still not ignored at this point if it:

  • has somehow been added to the index and committed (which, according to your setup, shouldn't be the case)
  • has a trailing space in the .gitignore file rule (like this msysgit config)
VonC
This was the solution. I must have copied the build/ entry from another file and had some whitespace at the end. Thanks, and nice catch!
Mark Struzinski
@Mark: a classic! I got burned myself with that one more than a few times...
VonC