How am I going to use git filter branch?
I tried this with no effect:
git filter-branch --msg-filter administrator...

I got a message saying:
git-rewrite already exists,please remove it

Apart from the message I just do not know how to use this directive and the 
manual confuses me...many commands go with it.

Τη Δευτέρα, 20 Ιουλίου 2015 - 9:28:29 μ.μ. UTC+3, ο χρήστης Konstantin 
Khomoutov έγραψε:
>
> On Mon, 20 Jul 2015 06:50:02 -0700 (PDT) 
> Dimitris Papageorgiou <foryo...@gmail.com <javascript:>> wrote: 
>
> > I have git init a working directory...here is 
> > it C:\Apache24\htdocs\Appointments\Administrator 
> > 
> > I now want to create git init another directory which sits *above 
> > *the aforementioned....C:\Apache24\htdocs\Appointments 
> > 
> > So....in essence....I want to disregard/delete the old 
> > branch/repo(C:\Apache24\htdocs\Appointments\Administrator)...*but 
> > keep the commits and transfer them to the new repo.* 
> > 
> > How am I going to do it? I hope I was clear. 
>
> Quite clear.  The only problem is with the message subject which misses 
> the point completely: a branch is a line of development in a repository, 
> and your question is about creating a new repository. 
>
> As to the problem at hand, I'd go this route: 
>
> 1) Use `git filter-branch` on all the relevant branches in your current 
>    repository to modify all the commits in them to make them record 
>    a prefix directory, "Administrator", in all their commits. 
>
> 2) Move the Git database directory (".git") one level up -- into the 
>    "Appointments" directory. 
>
> 3) `git add` everything needed under this directory (except 
>    "Administrator" -- as it will appear already tracked). 
>
> 4) Record the new commit. 
>
> The end result will be the repository which contains all the initial 
> history plus a single commit of the "new" data. 
>
> Modifying the history in the original repository is a hard part. 
> Basically you'll need to filter all the relevant branches in your 
> source repository.  Something like this: 
>
>   $ cd theRepo 
>   $ git branch tmp master 
>   $ git filter-branch --tree-filter 'mkdir -p ./Administrator && 
>       find . -mindepth 1 -path ./Administrator -prune -o -print | 
>       xargs mv -t ./Administrator' tmp 
>
>   ...now verify that the "tmp" branch looks OK, and replace "master" 
>   with it. 
>   Repeat for all the other branches. 
>
> (Note that this sinippet assumes a POSIX shell which means Git Bash in 
> your case.) 
>
> The problem here is that the history might have complicated graph of 
> intertwined histories, and that would make using `git filter-branch` an 
> excercise in patience and trial-and-error.  In such a case you might 
> nominate just a single branch for conversion and sacrifice some bits of 
> "full" history. 
>
> If you're OK with some history traceability, there's another approach 
> which is known as "subtree merging": 
>
> 1) Clone your source repository somewhere on the filesystem using 
>    something like 
>
>    git clone --bare src dst 
>
> 2) Move the whole "Administrator" directory (including ".git" in it) 
>    somewhere out of the tree. 
>
> 3) Initialize a new repository under "Appointments". 
>    `git add` everything needed except "Foo". 
>    Record a commit. 
>
> 4) Fetch the relevant branch from the repo created on step (1), 
>    say 
>
>      git fetch /c/path/to/dst master:dst-master 
>
>    to create the local branch "dst-master" containing the commits 
>    of source "master". 
>
> 5) "Subtree-merge" that new branch under the prefix "Administrator": 
>
>      git merge --no-commit dst-master 
>      git read-tree -u --prefix=Administrator dst-master 
>      git commit 
>
>    By now, you have your original history merged, and it appears under 
>    the directory "Administrator". 
>
> 6) Verify the contents under "Administrator" is the same that in the 
>    directory you've moved away on step (1) -- except for the ".git" 
>    subdirectory, of course. 
>
> The problem with this approach is that if you will try to trace the 
> history of the "Administrator" subdirectory or any file under it -- 
> using commands like 
>
>   git log -- Administrator 
>   git log -- Administrator/some/file 
>
> they will stop at the commit recorded on step (5) because the prefix 
> "Administrator" came into existence only then.  You will still be able 
> to traverse there using more explicit means, of course.  Read through 
> [2] for more info on these caveats. 
>
> 1. http://bpeirce.me/moving-one-git-repository-into-another.html 
> 2. https://groups.google.com/d/topic/git-users/HXoX-kpkYkM/discussion 
>

-- 
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/d/optout.

Reply via email to