Here's a nice trick to use when you need to do a selective commit in you version control system. Say you have 100's of files in different directories that have been changed, but you only want to commit a certain subset of those. This tip is especially useful if those files can be selected using shell commands.
1 svn st | grep \.install$ | cut -c 8- | xargs svn commit -m "Commit message." 2 # select files 3 # Remove the status indicators 4 # Pass the resulting filenames to svn commit
This particular command is selecting only files that end in ".install". You could use another argument to grep or other shell mechanisms in place of that.
The real trick here is the use of cut -c 8-, which chops off the first 7 characters (where svn st shows status information), and xargs, which reformats the line-delimited output of svn st and turns it into an argument list.

tagged with: 