Question

I have made changes to multiple files in my folder locally for testing purposes. However, I would like to revert them back to original condition except a single file, which I still need in the present condition. Presently, I use

svn revert -R .

which reverts all of them to original condition. Could someone help me, how to use a command that excludes a single file in this operation?

Was it helpful?

Solution

Two choices:

  • Add all needed to reverting files in changelist (add all, remove single file), use revert --cl
  • Store all files in text-file (space-separated list), pass it to revert --target FILE

You can also commit current state of WC into some temporary branch, revert all, merge singe file from branch to trunk

OTHER TIPS

+Update (from @lazy badger's ans): Steps:

  1. Svn status
  2. Grep all the changes except the filename having the pattern
  3. Remove unnecessary content (ex: M, ?, D, C)
  4. Save it to a file and use --targets filename

EX: svn status | grep "^\M" | grep -v "pattern" | awk '{print $2}' > change.txt This example will first get all the modified files without the pattern and then remove the unnecessary info from the path and then save it to a file.

After this, use svn revert --targets change.txt to revert the files

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top