How to substitute text from files in git history?

I’d recommend using the BFG Repo-Cleaner, a simpler, faster alternative to git-filter-branch specifically designed for rewriting files from Git history. You should carefully follow these steps here: https://rtyley.github.io/bfg-repo-cleaner/#usage – but the core bit is just this: download the BFG’s jar (requires Java 7 or above) and run this command: $ java -jar bfg.jar –replace-text replacements.txt … Read more

How to suppress the editor for `git rebase –continue`?

First approach, through Git configuration: git -c core.editor=true rebase –continue Or, with environment variables: GIT_EDITOR=true git rebase –continue This will override the editor that git uses for message confirmation. true command simply ends with zero exit code. It makes git continue rebase as if user closed interactive editor. On Windows, you would need to use … Read more

git, filter-branch on all branches

The solution is simple: git filter-branch [options] — –all Note the four dashes (two sets of double dashes with a space in between) in — –all. If you look at the docs for git-filter-branch, it says this: git filter-branch [–env-filter <command>] [–tree-filter <command>] [–index-filter <command>] [–parent-filter <command>] [–msg-filter <command>] [–commit-filter <command>] [–tag-name-filter <command>] [–subdirectory-filter <directory>] … Read more

git rebase – what’s the difference between ‘edit’ and ‘reword’

“reword” allows you to change ONLY the commit message, NOT the commit contents “edit” allows you to change BOTH commit contents AND commit message (the mechanism by which git allows you to edit the commit contents is by “pausing” the rebase; so you can amend the commit) reference : The git-rebase documentation says this: edit … Read more

Remove file from git repository (history)

I can’t say for sure without access to your repository data, but I believe there are probably one or more packed refs still referencing old commits from before you ran git filter-branch. This would explain why git fsck –full –unreachable doesn’t call the large blob an unreachable object, even though you’ve expired your reflog and … Read more

Purging file from Git repo failed, unable to create new backup

You have already performed a filter-branch operation. After filter-branch, Git keeps refs to the old commits around, in case something goes wrong. You can find those in .git/refs/original/…. Either delete that directory and all files within, or use the -f flag to force Git to delete the old references. git filter-branch -f \ –index-filter ‘git … Read more