Menu
  • HOME
  • TAGS

git filter-branch is not removing my directory

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...

How to remove an entry with null sha1 in a Git tree

git,git-filter-branch,fisheye

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' |...

What to do when accidentaly commited HUGE binary file / file with password as plain text?

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...

Can I rewrite an entire git repository's history to include something we forgot?

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 *...

Change timezone for all commits in git history

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]

Why does git filter-branch tree-filter fail to rewrite commit but then leave working directory dirty?

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,...

--chmod not working with index-filter

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...

How can I move multiple directories in a Git?

git,git-filter-branch

$ 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...

Rewrite git history according to a .mailmap file

git,git-filter-branch

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...

Remove mysterious ref from 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...

Remove unused assets from git history

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...

Which filters can be used together in git-filter-branch?

git,git-filter-branch

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]").

Find the right parent of a merge commit in a non-interactive way

git,git-svn,git-filter-branch

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....

When using git filter-branch, it duplicates my commit history and creates duplicate files. How do I get rid of this?

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...

Files deleted with git filter-branch reappear after push and pull back

git,gitlab,git-filter-branch

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.