File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -77,15 +77,18 @@ split_and_push() {
7777 fi
7878 git remote remove origin 2> /dev/null || true
7979 git remote add origin " $repo_url "
80- git push -u origin --all
80+ # Fetch remote default branch if exists (for safer force-with-lease in the future)
81+ git fetch origin " ${DEFAULT_BRANCH} " --depth=1 || true
82+ # Push the filtered history to the remote default branch, overwriting if needed
83+ git push -u origin HEAD:" ${DEFAULT_BRANCH} " --force
8184 git push origin --tags || true
8285 popd > /dev/null
8386 rm -rf " $tmp "
8487 else
8588 # Fallback: subtree split creates a synthetic branch with the path history
8689 local split_branch=" split-$( basename " $pkg_dir " ) -$( date +%s) "
8790 git subtree split --prefix=" $pkg_dir " -b " $split_branch " > /dev/null
88- git push " $repo_url " " $split_branch :${DEFAULT_BRANCH} "
91+ git push --force " $repo_url " " $split_branch :${DEFAULT_BRANCH} "
8992 # Push tags that include this history is non-trivial with subtree; skipping here
9093 git branch -D " $split_branch " > /dev/null
9194 fi
You can’t perform that action at this time.
0 commit comments