git,git-filter-branch,git-rewrite-history
Rewriting Git history is a tricky process and git-filter-branch doesn't make it easy (see below), so instead use the BFG, a simpler, faster alternative to git-filter-branch, specifically designed for removing unwanted files from Git history. Carefully follow the BFG's usage instructions - the core part is just this: $ java...
The message you get suggests that there was only a single tree with a bad submodule. In that case, there is very little you have to clean up. You can create a new fixed tree that doesn't have this problem: $ git ls-tree db22a67df70dc4ff90ec4cd666da91e9c2cb0d9 | > sed -e '/0\{40\}/d' |...
git,binary,branch,git-filter-branch
Easy thing - you wont need to cut out commits, just do: git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD It will delete all the file occurrences in history. You can mention $files as single file or as bunch of them. Note that it will create backup, so...
git,git-rebase,git-filter-branch,git-rewrite-history
What you want to do will involve two phases: retroactively add a new root with a suitable .gitignore and scrub your history to remove files that should not have been added. The git filter-branch command can do both. Setup Consider a representative of your history. $ git lola --name-status *...
git,timezone,git-filter-branch
I've come up with this, which seems to do the trick: git filter-branch --env-filter ' if [ "$GIT_AUTHOR_EMAIL" == "[email protected]" ]; then export GIT_AUTHOR_DATE=`echo $GIT_AUTHOR_DATE | sed s/+0000/+1000/` fi if [ "$GIT_COMMITTER_EMAIL" == "[email protected]" ]; then export GIT_COMMITTER_DATE=`echo $GIT_COMMITTER_DATE | sed s/+0000/+1000/` fi' This changes the timezone for author [email protected]
git,version-control,git-filter-branch
(converting comments to answer) The tree filter is run in a directory that is not the normal working directory for the repository. (The actual directory is derived from from the -d argument to git filter-branch, if you supply one; if you don't supply one, filter-branch starts with .git-rewrite. To this,...
git,git-bash,git-filter-branch,git-rewrite-history
Although your question focuses on git filter-branch to do the rewrite, it's worth considering the BFG instead -although it doesn't do it out of the box, it's a pretty small tweak to add a TreeBlobs cleaner that sets all files non-executable: https://github.com/rtyley/bfg-repo-cleaner/compare/non-executable You can build your custom version of the...
$ git filter-branch --tree-filter 'mv A1/B1/C1 .' HEAD This code ends up with error like "mv: cannot stat 'A1/B1/C1': No such file or directory". But this code below worked correctly. $ git filter-branch --tree-filter "ls A1/B1 | xargs -i -t mv A1/B1/{} A1 | sh" HEAD I do not know...
There is no short git command for this. One needs to use git filter-branch --commit-filter <command> [...] where <command> changes the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL variables using git check-mailmap with -c mailmap.file=/path/to/.mailmap or -c mailmap.blob=SOMEREV:path/to/.mailmap, e.g to use a .mailmap file from the master branch, one can use git...
git,garbage-collection,git-filter-branch
The full name is refs/original/refs/tags/1.0-rc80 and it lives in the refs/original name space. You were very close with this command: git update-ref -d original/refs/tags/1.0-rc80 except that update-ref requires that you spell out the full name, refs/original/refs/tags/1.0-rc80. You may have some additional refs/original/* names since git filter-branch copies any ref names...
git,git-filter-branch,git-rewrite-history
Use the BFG Repo-Cleaner, a simpler, faster alternative to git-filter-branch specifically designed for removing unwanted files from Git history. so I can programmatically remove all files that do not exist in HEAD anymore from the entire history of the repo By default, the BFG 'protects' all files in your HEAD...
They can in fact all be used together. The only thing not allowed is an attempt to set both --prune-empty and a --commit-filter (because --prune-empty is implemented as a commit filter, specifically, a filter of git_commit_non_empty_tree "[email protected]").
I found that there is no reliable way to do this, because git sees each parent as an equal, and it just uses them in whatever order it gets them. So I ended up doing it manually, as described above....
git,github,version-control,sed,git-filter-branch
The sed that comes with MacOS X is BSD sed, not GNU sed, and it cannot change files in place without making a backup - the its -i flag always takes an argument that is the suffix the backup file will have. In your call, -i -e is parsed as...
I merged the other branch into master and redid it. Works now. Can't tell whether it was an error on my part, or two branches have something to do with it.