Disclaimer: I know Git rocks, but people still use Subversion 🙂 !
Let’s say you have a Subversion checkout containing externals. Now you’ve made changes in many places within the folder structure and you want to get back to the original clean state.
So your typical approach would be to go to the top directory of the working copy and do a recursive revert using:
svn revert -R .
But unfortunately nothing happens! The reason is that the working copy is made up of sub folders containing externals and in order to revert them you need to go into each sub directory and then issue the svn revert command. This can be cumbersome if you have a working copy containing many subfolders corresponding to externals.
Well the solution is pretty simple if you have a bash shell (Windows users will require Cygwin or something similar)
for d in ./*/ ; do (cd "$d" && svn revert -R .); done
This little bash script will change (cd) into all sub folders using a loop and execute an svn revert within each ‘external’ folder recursively.
The solution was inspired by this thread on StackExchange.