I extracted a subtree from a large repo using git subtree split
and pushed it to another remote.
I can successfully pull commits from that subtree remote.
However, when I'm trying to push changes from main project to subtree I see somthing like
C:\Dev\projects\myproject>git subtree push -P services/myService subtree-repo master
git push using: subtree-repo master
227/400 (226)
So all commits since subtree split
are processed to identify what to push. If 2 commits out of 400 where related to services/myService, than only these 2are pushed, so this is correct behaviour.
However, processing 400 commits takes a lot of time, and this number can dramatically increase up to several thousands in a month, so every single push will take an hour or so. That is unacceptable.
I tried to resolve it by myself and found this answer.
Shortly, it advises to use git subtree split
with --rejoin
flag, so merge commit with subtree reference will be generated, and next push only commits since that merge will be processed.
Unfortunately, that didn't work for me. Executing git subtree split
C:\Dev\projects\myproject>git subtree split --rejoin -P services/myService
4/400 (3)
Finishes successfully:
C:\Dev\projects\myproject>git subtree split --rejoin -P services/myService
Already up-to-date.
0e50cea87309b1ec79a00113165d9db2baa8f862
but goes through all commits again and again (and git subtree push also
).
What is interesting, executing the same command in Git Bash returns an error.
$ git subtree split --rejoin -P services/myService
C:/Users/myUser/AppData/Local/Programs/Git/mingw64/libexec/git-core\git-subtree: line 751:
14516 Done eval "$grl"
17364 Segmentation fault (core dumped) | while read rev parents; do
process_split_commit "$rev" "$parents" 0;
done
So could you please help to find an answer how to make git subtree
not to go through all commits since subtree adding