After some trying around, I got this answer to work and figured out how to use it for your checkout. I made some additional changes to squelch a warning that would sometimes be printed and had to fix the argument parsing to be a bit more flexible. (Since this is originally a plumbing script where the arguments get pre-processed by the git core, this is not necessary in the original version).
You can use this version of the file (raw file for save-link-as convenience) and copy it to somewhere in your PATH
, as described in the linked answer. Be sure to also set its executable bit (chmod +x path/to/file
) after downloading.
Assuming you named the file git-add--interactive--words
as suggested, you can use the following command to define an alias for it:
git config --global alias.cop add--interactive--words --patch=checkout
Now you can do something like:
git cop HEAD~5
to do an interactive checkout of . (current dir) 5 commits ago, or
git cop master -- docs/README
to interactively check out docs/README from branch master
You can call the alias anything you want, of course (I chose cop here for 'c'heck'o'ut --'p'atch).
I know this answer is really late so it's possibly not applicable for you anymore, but this question has been on the unanswered list for so long that I just had to figure it out today -- maybe it'll help someone else ;)