More Fun with 'git filter-branch'

Previously, I covered the use of the git filter-branch for removing large media assets from a repository’s history. Recently I had a new opportunity to perform this task on whole directories. Here is the command sequence I used to clean up the repo history and to shrink the pack file: # Remove a directory from history in all branches and tags $ git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch path/to/dir' --tag-name-filter cat -- --all # Shrink the local pack $ rm -Rf ....

2014-04-01 · 1 min · 188 words · Nathaniel Hoag

Snapshot: My Git Usage

Following are the Git commands and Git family of tools that I use in my day-to-day. Before writing this post, I generated a report of my most-used git sub-commands with the following: history | awk '$2 == "git" {print $3}' | sort | uniq -c | sort -nr | head -n 20 Most of my Git usage is bread-and-butter Git commands, but I’ll highlight some of my favorite Git features below....

2014-03-15 · 4 min · 681 words · Nathaniel Hoag

Tools and Processes

bash tricks accumulated over the last several weeks: Argument expansion Need to move or copy a file under a long directory tree? cp /this/is/a/really/long/path/to/{file-01,file-02}.txt Git filter-branch Need to get rid of large media files in your Git repo throughout the entire history of the project? git filter-branch --index-filter \ 'git rm --cached --ignore-unmatch ./path/to/file/*.ext' \ --tag-name-filter cat -- --all Supports wildcard matching! History Expansion There are several techniques here, but my current favorites are sudo !...

2013-11-06 · 2 min · 244 words · Nathaniel Hoag