git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ping Yin" <pkufranky@gmail.com>
To: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Cc: "Alex Riesen" <raa.lkml@gmail.com>,
	"Git Mailing List" <git@vger.kernel.org>
Subject: Re: How to change a submodue as a subdirectory?
Date: Thu, 15 Nov 2007 16:14:19 +0800	[thread overview]
Message-ID: <46dff0320711150014x4a35975eqc53ef1fce7d40b18@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0711150614380.4362@racer.site>

On Nov 15, 2007 2:16 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> 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

  reply	other threads:[~2007-11-15  8:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-14 14:37 How to change a submodue as a subdirectory? Ping Yin
2007-11-14 20:26 ` Alex Riesen
2007-11-15  5:36   ` Ping Yin
2007-11-15  6:16     ` Johannes Schindelin
2007-11-15  8:14       ` Ping Yin [this message]
2007-11-15 12:28         ` Johannes Schindelin
2007-11-15 16:41           ` Ping Yin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46dff0320711150014x4a35975eqc53ef1fce7d40b18@mail.gmail.com \
    --to=pkufranky@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=raa.lkml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).