Git subdirectory filter with existing directory structure

后端 未结 2 1835
北荒
北荒 2021-02-05 15:42

I\'m splitting out a Git repository using the --subdirectory-filter option of filter-branch which is working great except it pulls everything up to the root of the repository.

2条回答
  •  滥情空心
    2021-02-05 16:15

    I found an answer here which does the trick.

    The command:

    git filter-branch -f --index-filter 'git ls-files -s \
    | sed "s-\t-&ABC/DEF/-" \
    | GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info \
    && mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE'
    

    works perfectly

提交回复
热议问题