Oved D
Oved D

Reputation: 7442

How do I ignore all svn, bin, and obj folders when creating a git repository?

I'm totally new to git and want to create a repository in a directory that has existing .svn folders and compiled folders bin and obj. After running init on a directory, what is the command to ignore these folders? I'm using GitBash on Windows.

Upvotes: 3

Views: 6100

Answers (1)

Ryan Stewart
Ryan Stewart

Reputation: 128829

Simplest and shareable way is to create a file called .gitignore in the project's root directory with this content:

.svn
bin
obj

You can do that quickly from the command line with:

echo .svn >> .gitignore
echo bin >> .gitignore
echo obj >> .gitignore

Commit your .gitignore file to the repo, and everyone can benefit from it. Alternately, add .gitignore to the .gitignore file, and it will be ignored as well. Note that if this is a clone of an SVN repo, you can also use git svn create-ignore or git svn show-ignore. The former will reads the svn:ignore property and creates matching .gitignore files in all the appropriate directories. I prefer the latter, which lists out all the "ignore patterns" in a format that can be appended to a root .gitignore file.

Upvotes: 11

Related Questions