Skip to content

Instantly share code, notes, and snippets.

@pedrokoblitz
Last active April 20, 2016 16:42
Show Gist options
  • Save pedrokoblitz/382768fc9d83bf5706cf9baad3846b30 to your computer and use it in GitHub Desktop.
Save pedrokoblitz/382768fc9d83bf5706cf9baad3846b30 to your computer and use it in GitHub Desktop.
remove files from git history
# remove from git and commit
git rm -r dir1/ dir2/ file.1
git commit -m 'remmove stuff'
# remove from branch history
git filter-branch --index-filter \
'git rm -r --ignore-unmatch --cached dir1/ dir2 file.1' -- 7b30847^.. # last commit BEFORE removing stuff
# remove from filesystem
rm -rf dir1/ dir2/ file.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment