Thread (25 messages) flat view 25 messages, 5 authors, 2016-06-15

Re: git filter-branch --subdirectory-filter, still a mistery

From: Thomas Rast <hidden>
Date: 2016-06-15 22:45:07

Jan Wielemaker wrote:
[...]
	% git filter-branch --subdirectory-filter packages/chr HEAD

This indeed creates a nice directory holding only the contents of
packages/chr.  But, starting qgit I see that all commits, also those
that had absolutely nothing to do with this dir are still there.
The trick is to rewrite all refs, not just HEAD.  I usually proceed as
follows:

  cp -a repo repo.old  # just to keep a backup
  cd repo
  git filter-branch --subdirectory-filter somedir -- --all

The --all tells it to rewrite as many refs as possible.  Note that the
-- is required.  Also note that refs/original/* will still point to
the old commits, so they won't "just vanish".  You may want to clone
the repository or delete them manually once you are sure the
filter-branch did the right thing.

- Thomas

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help