A faster and easier-to-understand filter that accomplishes the same thing:
git filter-branch --index-filter '
git read-tree --empty
git reset $GIT_COMMIT -- $your $files $here
' \
-- --all -- $your $files $here
More Related Contents:
- How to change the author and committer name and e-mail of multiple commits in Git?
- Detach (move) subdirectory into separate Git repository
- Remove sensitive files and their commits from Git history
- How do you fix a bad merge, and replay your good commits onto a fixed merge?
- Change first commit of project with Git? [duplicate]
- How do I remove the old history from a git repository?
- How to substitute text from files in git history?
- Completely remove files from Git repo and remote on GitHub
- How do I change the author and committer name/email for multiple commits?
- Detach many subdirectories into a new, separate Git repository
- How can I move a directory in a Git repo for all commits?
- Splitting a set of files within a git repo into their own repository, preserving relevant history [duplicate]
- Split large Git repository into many smaller ones
- How to split a git repository while preserving subdirectories?
- How do I run a code formatter over my source without modifying git history?
- Could I change my name and surname in all previous commits?
- How can I rewrite history so that all files, except the ones I already moved, are in a subdirectory?
- Update a development team with rewritten Git repo history, removing big files
- Running filter-branch over a range of commits
- Why has git-filter-branch not rewritten tags?
- Rewrite history git filter-branch create / split into submodules / subprojects
- Can tags be automatically moved after a git filter-branch and rebase?
- git rm – fatal: pathspec did not match any files
- Git – remove commits with empty changeset using filter-branch
- Which commit has this blob?
- How can I make git ignore future revisions to a file?
- Unable to access ‘git/attributes’
- Issue with adding common code as git submodule: “already exists in the index”
- “Cannot update paths and switch to branch at the same time”
- ‘git log’ output encoding issues in Windows 10 CLI terminal