This is helping me sooo much that it would a crime not to share it. It's actually nothing fancy, just a very convenient thing that I've learned to get used to. ff is an executable script I use to find files in a git repository. Goes like this:


$ ff list
templates/operations/network-packing-list.html
templates/sales/list_orders.html
$ ff venue
templates/venues/venues-by-special.html
templates/venues/venues.html
templatetags/venue_extras.py
templatetags/venues_by_network_extras.py
tests/test_venues.py

It makes it easy to super quickly search for added files without having to use the slow find command which would also otherwise find backup files and other junk that isn't checked in.

To install it, create a file called ~/bin/ff and make it executable:


$ chmod +x ~/bin/ff

Then type this code in:


#!/usr/bin/python
import sys, os
args = sys.argv[1:]
i = False
if '-i' in args:
   i = True
   args.remove('-i')
pattern = args[-1]
extra_args = ''
if len(args) > 1:
   extra_args = ' '.join(args[:-1])
param = i and "-i" or ""
cmd = "git ls-files | grep %s %s '%s'" % (param, extra_args, pattern)
os.system(cmd)

Comments

Tom

Why not just add to your .bashrc:

alias ff="git ls-files | grep"

iivvoo

fyi your postings keep appearing double (with a significant delay) in my google reader.

Your email will never ever be published.

Previous:
My AWS CloudFront bill March 23, 2011 This site
Next:
Google's new Page Speed Online hard to beat April 4, 2011 Web development
Related by category:
set -ex - The most useful bash trick of the year August 31, 2014 Linux
brotli_static in Nginx November 8, 2024 Linux
Be very careful with your add_header in Nginx! You might make your site insecure February 11, 2018 Linux
Linux tip: du --max-depth=1 September 27, 2007 Linux
Related by keyword:
How to resolve a git conflict in poetry.lock February 7, 2020 Python
set -ex - The most useful bash trick of the year August 31, 2014 Linux
How to get all of MDN Web Docs running locally June 9, 2021 Web development, MDN
How to intercept and react to non-zero exits in bash February 23, 2023 Bash, GitHub