David Underhill » git: forever remove files or folders from history
october 2011 by faunzy
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0
fi
# make sure we're at the root of git repo
if [ ! -d .git ]; then
echo "Error: must run this script from the root of a git repository"
exit 1
fi
# remove all paths passed as arguments from the history of the repo
files=$@
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD
# remove the temporary history git-filter-branch otherwise leaves behind for a long time
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune
files
git
history
howto
repository
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0
fi
# make sure we're at the root of git repo
if [ ! -d .git ]; then
echo "Error: must run this script from the root of a git repository"
exit 1
fi
# remove all paths passed as arguments from the history of the repo
files=$@
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD
# remove the temporary history git-filter-branch otherwise leaves behind for a long time
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune
october 2011 by faunzy
apenwarr/bup - GitHub
july 2011 by faunzy
tar -cvf - /etc | bup split -n local-etc -vv
backup
git
linux
opensource
software
july 2011 by faunzy
Using Git to manage a web site
july 2011 by faunzy
GIT_WORK_TREE=/var/www/www.example.org git checkout -f
deployment
git
howto
web
webdev
july 2011 by faunzy
related tags
apache ⊕ application ⊕ article ⊕ automation ⊕ backup ⊕ bash ⊕ bestpractices ⊕ blog ⊕ blogging ⊕ book ⊕ books ⊕ bundle ⊕ capistrano ⊕ cheat ⊕ cheatsheet ⊕ code ⊕ coding ⊕ comparison ⊕ configuration ⊕ continuousintegration ⊕ conventions ⊕ ctags ⊕ debug ⊕ deploy ⊕ deployment ⊕ dev ⊕ development ⊕ diff ⊕ documentation ⊕ ebook ⊕ editor ⊕ engine ⊕ file ⊕ files ⊕ flashbake ⊕ framework ⊕ free ⊕ gem ⊕ gems ⊕ git ⊖ github ⊕ growl ⊕ gtd ⊕ gui ⊕ guide ⊕ hacks ⊕ hashrocket ⊕ history ⊕ hooks ⊕ hosting ⊕ howto ⊕ lifehacks ⊕ linux ⊕ mac ⊕ macosx ⊕ management ⊕ marley ⊕ meetup ⊕ mercurial ⊕ merge ⊕ notifications ⊕ opensource ⊕ optimization ⊕ osx ⊕ pair_programming ⊕ peepcode ⊕ plugin ⊕ pre-commit ⊕ presentation ⊕ productivity ⊕ programming ⊕ prompt ⊕ rails ⊕ reference ⊕ repository ⊕ rspec ⊕ ruby ⊕ rubygems ⊕ rubyonrails ⊕ safari ⊕ scm ⊕ screencast ⊕ screencasts ⊕ server ⊕ sharing ⊕ sinatra ⊕ slides ⊕ socialnetworking ⊕ software ⊕ source ⊕ standards ⊕ status ⊕ subversion ⊕ svn ⊕ sysadmin ⊕ teams ⊕ testing ⊕ textmate ⊕ tips ⊕ tool ⊕ tools ⊕ tutorial ⊕ tutorials ⊕ ubuntu ⊕ unit_testing ⊕ vcs ⊕ version ⊕ versioncontrol ⊕ version_control ⊕ video ⊕ videos ⊕ vim ⊕ web ⊕ webdev ⊕ wordpress ⊕ workflow ⊕Copy this bookmark: