You cannot ignore files that are already in the repository.
Reread that first sentence.
Ignoring something in a version control system says to ignore files that aren't already in the version control system. For example, Imagine you have a compilation process that took the *.c
files that are in your repository and compiled them into *.o
files. The *.o
files are simply part of the compilation process, and you certainly don't want them accidentally added into your repository.
If you ignore *.o
files, and you did a svn status
in Subversion, Subversion won't report on those files. If you did a svn add *
, Subversion won't add those files to your repository. That's what ignore means in a version control system.
If you modify a file, and you don't want to change it when you do a commit, you have a few choices:
- Use changelists to organize your files.
- List the files you want to commit on the
svn commit
command line. - Revert the files you don't want to change before you do a commit. Before I commit, I always do a
svn status
just to make sure that I'm not accidentally modifying a file that I don't want to change.
I don't know how changelists work in TortoiseSVN, but you can put the files you don't want to commit. The files you want to ignore, into a changelist. The problem is that you can't operate on negated change lists. For example:
$ svn --cl ignore foo bar barfoo
$ svn status
M blat
M floob
--- Changelist 'ignore'
M foo
M bar
M barfoo
I can't say:
$ svn ! --cl foo commit
and only commit changes on floob and blat (unless I create a changelist for these files too).
Instead, you'll revert the files in your changelist ignore, then commit:
$ svn revert --cl ignore -R . #Reverts all files in the changelist
$ svn commit --keep-changelists #Commits all other files
Note that the --keep-changelist
option will keep the files you put on the changelist on the changelist even though they have no changes. This way, you can revert them again before the next commit.