문제

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?

도움이 되었습니까?

해결책

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

다른 팁

+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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top