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

Trying to split repository

From
JWJosef Wolf <jw@raven.inka.de>
Date
Oct 1, 2009, 16:03 UTC
Message-ID
<20091001160335.GA26068@raven.wolf.lan>
Hello,

One of my repositories has grown a subdirectory that I'd like to split off, so other can use it as a subproject. With the help of google, I found this solution:

    # first extract the library from the original repository
    #
    git clone --no-hardlinks repository library.tmp
    (
        cd library.tmp
        git filter-branch --subdirectory-filter CF -- --all
        git reset --hard
        git gc --aggressive
        git prune
        git gc
        git clone --bare . ../library
    )
    rm -rf library.tmp
    # Now remove the library from the original repository, so it can be
    # included as a subproject
    #
    git clone --no-hardlinks repository repository.new.tmp
    (
        cd repository.new.tmp
        git filter-branch \
            --index-filter "git rm -r -f --cached --ignore-unmatch CF" \
            -- --all
        git reset --hard
        git gc --aggressive
        git prune
        git gc
        git clone --bare . ../repository.new
    )
    rm -rf repository.new.tmp

This works fine. But there's one problem, though. "gitk --all" in the new repository still shows all the history of the removed library. The patch show no modifications, but the log entry is still there.

Any hints how to get rid of those log entries?
Next: Adam Brewster
Message 1 of 9 in “Trying to split repository”
  1. Josef WolfOct 1, 2009
  2. Adam BrewsterOct 1, 2009
  3. Josef WolfOct 1, 2009
  4. Adam BrewsterOct 2, 2009
  5. filter-branch: add --prune-empty to option summaryAdam Brewster, Oct 2, 2009
  6. Jeff KingOct 2, 2009
  7. Adam BrewsterOct 2, 2009
  8. Josef WolfOct 2, 2009
  9. Tomas CarneckyOct 1, 2009

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.