Friday, November 4, 2016

TIP: recover file from old Git branch

In cleaning up my source code I realize I was too... aggresive in my house cleaning. I deleted a file I needed.  No biggie, just take a look at HEAD or HEAD^... Hey, that didn't work!

TIP: use git rev-list to search and find the most recent commit that affected (deleted) a path. (Source: Charles Bailey on SO)

$ git rev-list -n 1 HEAD -- docker/torta/torta-task.json
0c400d323aff484cfb2bdc18dcdb7813de93a658

Yay!  That was really easy. Now all I need to do is check out from that Git hash and I'm done:

$ git checkout 0c400d323aff484cfb2bdc18dcdb7813de93a658 !$
error: pathspec 'docker/torta/torta-task.json' did not match any file(s) known to git.

Err?  Hmm. Oh: the 0c4 branch contains the "delete" command. If I want to get the file contents, I'll get it from the branch just before that one:

$ git checkout 0c400d323aff484cfb2bdc18dcdb7813de93a658^ docker/torta/torta-task.json
$ ls -l docker/torta/torta-task.json
-rw-r--r--  1 johnm  staff  1445 Nov  4 13:06 docker/torta/torta-task.json

Yay, it worked!  Thanks, interwebs!

Tuesday, November 1, 2016

Videos! For "Platonic Solids of Quality" and "Functional Programming and Django QuerySets"

I've been remiss in posting my videos.  The last two talks went really well

- Platonic Solids of Quality

As people who produce awesome stuff, there are a lot of tools we can use to work less and simplify our workflow. This talk introduces many techniques from Agile Testing and other sources so we can all do more things faster.

- Functional Programming and Django QuerySets

This talk is a quick overview of Python iterators and why to use them, then combining iterators in Functional Programming (vs procedural and object oriented programming). Lastly I show how to use these ideas in order to better understand and test Django QuerySets.

I have another talk video somewhere, but it's about using Selenium for testing and thus has rather a bit of profanity in it.  No link.

Thanks to Don Westland for recording-editing these for me!