Follow renames when performing git subtree split -


I have several subdirectories that I want to draw in a separate repo with the same command to remove them I take them (rename) in a sub-directory within.

Then I run: git subtree split -p my_new_subdir -b newbranch

If I then check this new branch and git Run the log - Follow some foldfollow This only shows the log entries related to moving to the temporary subdirectory. I want to continue the entire history of those files.

Is there a way to preserve full history while doing a sub-to-split? Is there any other means of achieving desired results?

I have considered using filter-branch on the repo clone, but I know that it will be very slow.

If you want to leave files from my_new_subdir , then you really need to remove all your files using the concept:

  Git filter-branch - tag-name-filter-cat - index-filter \ 'git rm -r - cached --ignore-unmatch unneeded-subdir -1 unnecessary-pattern- * unnecessary- and so on' \ --prune- You can use sth to help find out what else to delete:  
  GIT log -  -name-status --all | Grep -P '^ \ w \ s + [\ S] + $'   

or even example:

  git logs - Name-status - All | Grep -P '^ \ w \ s + [\ S] + $' | | \ Sed s /^.// | Cut-F 1-2-D '/' | Sort-u   

In this way you can get all files / directories (or in the second case, only the first two segments) that were present at the repo at any time. After that you can use the following command to clean the repo:

  git gc - agressive   

after leaving the file < Code> my_new_subdir I used the combination of the above commands to clear any unnecessary files from history, although I still have got unrelated merge in history, but in the end I am satisfied with the result. Note that the number of parameters for the above guit command is important for running through all the history, branches and tags.

To speed things up, you can first identify the largest parts of the repo to remove the repetition GIT GC - Aggressive . Having I5 CPU and SSD disc took me about a minute to complete a git filter-branch and about 1000 history entries were processed.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -