Re: How to change a submodue as a subdirectory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 15, 2007 2:16 PM, Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
> Provided you do not kill the repository of the submodule (you have some
> public repo for that, right?) you will not lose anything, since the
> history of the superproject has pointers to the submodule.
>
> But I guess that you want something different... You probably want to
> rewrite history as if the submodule had not been a submodule at all,
> right?
Yeah, this actually what i want. Now i find a way:
1. move submodule subB outside
    mv subB /newpath/to/subB
    git-commit subB
2. git-filter-branch to rename all files in subA repository to subB
directory (say subB/subB).

       cd newpath/to/subB &&
       git filter-branch --index-filter \
               'git ls-files -s | sed "s-\t-&subB/-" |
                       GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
                               git update-index --index-info &&
                mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
3. in directory of super project superA, git-fetch repository subB to
branch subB
   cd path/to/superA && git-fetch /newpath/to/subB master:subB
4. git-cherry-pick each commit  (except the root commit) of branch
subB to the super project superA
    git-cherry HEAD subB | awk '{print $2}' | sed -n '2,$ p' | while
read name; do git cherry-pick $name; done
>
> Ciao,
> Dscho
>
>



-- 
Ping Yin
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux