Git rewrite history move folders and files up to parent folders -
i want rewrite history , move files , folders in folder 2 folders branches.
my repo looks like:
- src
- v105
- src
- files
- folders
- tools
- lib
i want be:
- src
- files
- folders
- tools
- lib
i know how rewrite history removing files recursively in folder
git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatched somefolder/somefolder' --prune-empty --tag-name-filter cat -- --all
i know git mv
command.
using following command files , folders moved correct folder. first patterns matches files , folders within provided folder. second pattern matches files , folders starting dot.
git mv src/v105/src/* src/v105/src/.[^.]* src
however when want use command rewrite history command doesn't work.
git filter-branch --force --index-filter 'git mv src/v105/src/* src/v105/src/.[^.]* src --cached --ignore-unmatched' --prune-empty --tag-name-filter cat -- --all
because src folder not exist in cases in commit history tells me can't find src dir. ideas how solve this?
update
git filter-branch --force --index-filter 'if [-d 'src/v105/'] git mv src/v105/src/* src/v105/src/.[^.]* src fi' --prune-empty --tag-name-filter cat -- --all
results in unexpected end of file.
the filter commands don't need git commands. simple this?
git filter-branch --force -tree-filter 'mv src/src/files src/; mv src/src/folders src/'
Comments
Post a Comment