You were an excellent partner in every way. You delivered your commitments on time, you provided clear guidance on what you needed from me, why you needed it, and when my communication was not sufficient you asked for clarification.

919-341-5170

help@ideacode.com

 

Blazing a trail to better facilities management.

CommandLine

Doh! I needed that file!

Every once and a while, I remove a file (or directory of files) from my local repository that I want back.  No big deal, it's in the repository.  Well, yeah, but finding it and using the right command is not so straightforward.  And since I recently deleted a whole bunch of files and I'm waiting to get them back, I'll show you how.

To recover deleted files from svn, first find the revision in which the file(s) existed:

cd /path/to/local/repository/
svn log --verbose .

I had a lot of files to recover, so I piped the output to a temporary file and cut out the junk I didn't need.

Second step, recover those files:

Finding files common amongst two (or more) directories

I've been preparing for a conference next week, so I haven't had much time to write.  This week, I'll leave you with a little useful command line fu.

The problem: you have two directories, called v1 and v2.  v2 is mostly like v1, except there are maybe some new files in v2 or v1 has files v2 doesn't.  The need: list the files that appear in both.

find v[12] -type f | cut -f 2- -d / | sort | uniq -c | grep '^      2'

Which finds all files in "v1" and "v2", removes the leading directory part, sorts them in order to count how many times each line appears, and limits to those that appear twice.

Syndicate content