This question is about rewriting git history. Six months ago I decided to make changes over an existing subfolder of my repository, and now I've changed my mind and want to undo that and all the associated history. Note, I want changes outside that subfolder should be left as is.
So, specifically, I am trying to remove the history of all the changes made within one of the subfolders of the repo, from a certain date onwards.
The end result I am hoping for should look like no edits/adds/deletes were ever made in the subfolder after that date.
Looking at the the answer to Remove file from git repository (history), and also http://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-a-git-repository, the closest I've got is this:
git filter-branch --index-filter 'git rm -r -f --cached --ignore-unmatch TheFolderToRemove' --prune-empty --all xxxxxx..HEAD
git reset --hard
git remote rm origin
rm -r .git/refs/original/
git reflog expire --expire=now --all
git gc --aggressive
git prune
This removes all the files in the subfolder.
Can someone please show me how to modify this so that it just removes the changes applied within the folder? Many thanks