git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-filter-branch behavior

From
DNDavid Neu <david@davidneu.com>
Date
Aug 13, 2008, 16:14 UTC
Message-ID
<e0b44a890808130914oced739cy2aaf54aebfcfcbce@mail.gmail.com>
All,
Running
git-filter-branch --tree-filter 'rm -rf subdir/' -- --all

as shown below seems to leave empty commits corresponding to subdir/ in the tree. Is this the expected behavior? If so is there a command to remove the empty commits? Using git-rebase -i to edit the commit history works, but is a bit tedious on a large tree.

Many thanks!

Cheers, David

***** ***** ***** ***** *****

mkdir test-filter-branch cd test-filter-branch

echo 'base1' > base.txt mkdir subdir echo 'sub1' > subdir/sub.txt git-init git-add . git-commit -a -m "Commit 1"

echo 'base2' >> base.txt git-commit -a -m "Commit 2"

echo 'sub3' > subdir/sub.txt git-commit -a -m "Commit 3"

echo 'base4' >> base.txt echo 'sub4' > subdir/sub.txt git-commit -a -m "Commit 4"

git-filter-branch --tree-filter 'rm -rf subdir/' -- --all
gitk &
Next: Jonathan Nieder
Message 1 of 4 in “git-filter-branch behavior”
  1. David NeuAug 13, 2008
  2. Jonathan NiederAug 13, 2008
  3. Jonathan NiederAug 13, 2008
  4. Michael J GruberAug 15, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.