With TortoiseSVN, I can move a file into the ignore-on-commit changelist, so that when I commit a whole tree, changes to that file do not get committed.
Is there a way to do something like that using the svn command-line tool?
EDIT: Thanks for the suggestions to use svn:ignore
, but that doesn't do quite what I was looking for.
svn:ignore
affects things like svn add
& svn import
. It gives it a list of filename patterns to ignore.
I have a file that's already under source control, but I want to make temporary changes to that file that I don't want to be committed later on when I commit the whole source tree. I am making a lot of other changes and I could stick a note on my monitor telling me to revert that file before I commit the tree, but it would be nice if svn could automatically skip that file.
Some of the proposed ideas can be implemented like this:
On Windows in PowerShell
add all to default list.ps1
add to ignore list.ps1
Now, you can alias
svn ci --changelist default
so that you don't have to specify it each time. The additional benefit is that you can store the ignore-on-commit list (if you want) in the repository.I do this for some files which are constantly regenerated but rarely actually changed by hand. For instance I add revision number to my config files on specific placeholders so files are changed on each commit, yet manual change is rare.
This is late to the game, but I found the most awesome-est command line command for this problem. Done using bash. Enjoy.
Ok, so here's an explanation of the command. Some things will need to be changed based on your use case.
I get a list of all the files. They'll all start with those status characters (?, !, A, etc). Each is on its own lines
I use grep to filter the list. It can either be used normally (to include) or with the -v flag (to exclude). In this case, it's being used to exclude, with a phrase "excluding" being what will be excluded.
Now I remove the status character and whitespace at the beginning of each line, and then quote each line, using sed. Some of my filenames have spaces in them, hence the quoting.
Using tr, I replace all newlines with spaces. Now my entire list of files to commit is on one line.
Lastly, I use xargs to execute my commit command with the message. It does the commit, and drops my quoted file list as the last argument.
The result is that everything ultimately works the way that I want it to. I still kind of hate svn for forcing me to jump through these goddamn hoops, but I can live with this. I guess.
svn:ignore
is your answer.Example:
Conflicted files are not allowed to be committed. You can take advantage of this to keep your private changes out of the repository. This works best with a small number of files.
To get a conflict for
a-file
, your working copy (WC) does not have the up to datea-file
from the repository, and that thea-file
in your WC has changes that are in the same location as changes in the repository (changes that you didn't update to yet). If you don't want to wait for the conditions above you can create a conflict fora-file
like this:In working copy 1 (WC1), add a line of text to the top of
a-file
, such as "make a conflict here". Use the necessary syntax so that you don't break the repository. Commita-file
from WC1. In WC2, add a different line of text to the top ofa-file
, like "i want a conflict". Update from WC2, and now a-file should be in conflict.I came to this thread looking for a way to make an "atomic" commit of just some files and instead of ignoring some files on commit I went the other way and only commited the files I wanted:
Maybe, it will help someone.
the
*.xml
is the pattern of files to ignore; you can use directory names here as well.