git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to change a submodue as a subdirectory?

From
Ping Yin <pkufranky@gmail.com>
Date
Nov 15, 2007, 16:41 UTC
Message-ID
<46dff0320711150841g1ec2a238r7fe5650e8cfaee03@mail.gmail.com>
In-Reply-To
<Pine.LNX.4.64.0711151322590.16728@wbgn129.biozentrum.uni-wuerzburg.de>
On Nov 15, 2007 8:28 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 6 quoted lines
>
> > 1. move submodule subB outside
> >     mv subB /newpath/to/subB
> >     git-commit subB
>
> Strictly speaking, you do not have to move it outside.

Hmm, you're right. I can just just remove it after fetch subB as a branch of superA.

Show 12 quoted lines
>
> > 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
>
> No need to play games with GIT_INDEX_FILE, as far as I can tell.

I just follow the example of git-filter-branch manual page. If not using GIT_INDEX_FILE.new, the GIT_INDEX_FILE will be read and wirtten at the same time since it is read and writtern at the same in a pipe. Will this be ok?

Show 7 quoted lines
>
> > 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
>
> If you plan to do away with subB, you do not need to specify it... Just
> use FETCH_HEAD, directly after the fetch.
Hmm, using FETCH_HEAD is really better.
Show 5 quoted lines
> The git-cherry call is not really necessary, right?  The two repos have no
> common history (not even common patches).
>
> Besides, I think that what you did is just a complicated way of doing a
> rebase.
I tried rebase, wonderful!
Show 5 quoted lines
>
> Ciao,
> Dscho
>
>
-- 
Ping Yin
Previous: Johannes Schindelin
Message 7 of 7 in “How to change a submodue as a subdirectory?”
  1. Ping YinNov 14, 2007
  2. Alex RiesenNov 14, 2007
  3. Ping YinNov 15, 2007
  4. Johannes SchindelinNov 15, 2007
  5. Ping YinNov 15, 2007
  6. Johannes SchindelinNov 15, 2007
  7. Ping YinNov 15, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.