On Tue, 17 Sep 2013 05:21:08 -0700 (PDT)
Gabriel Marchesan Almeida <gabrielmarche...@gmail.com> wrote:

> I am trying to extract subdirectories from a git repo and I have done
> so far these steps..
-------------------------------------------------------------------------------------------Filter
 
> subdirectory 
> 
> git filter-branch --tag-name-filter cat --prune-empty
> --subdirectory-filter ./Subfolder HEAD
> 
>  Delete history 
> 
> git reset --hard
> git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1
> git update-ref -d git reflog expire --expire=now --all
> git gc --aggressive --prune=now 
> 
> -------------------------------------------------------------------------------------------
> 
> The problem is that it extracts all the tags and not the only ones
> from this repo. 

What do you mean by "from this repo"?  There's no such thing as "tags
from this repo" and "tags not from this repo".

Or do you mean the resulting repository contains tags pointing to
commits which do not belong to the new set of commits `git
filter-branch` created when it was synthesizing the new history?

Then I'd say the way to go would be along the lines of:

$ (git rev-list --branches
          | while read c; do git tag --contains $c; done) |
      sort -u >/tmp/valid
$ git tag --list | grep -v -F -f /tmp/valid |
      while read t; do git tag -d "$t"; done

That is, on the first step create a list of all tags pointing to
commits reachable from your branches then on the second step obtain the
list of tags which are not in the set generated on the previous step,
and delete them.  I have not tested this solution -- it's just an idea.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to