Trashed a function but need it again? Find it in your git history with:
1 | $ git log -Ssearchterm
|
Note: No space between the -S flag and your search term.
If you want to then restore the source file in its entirety:
1 | $ git show HEAD^:views.py > ~/old_views.py
|
Turns out in this case I was able to find the supposedly-missing function in another file.
Sometimes you just gotta $ find . -name "*.py" | xargs grep <term>.
- References: