Git: Move files from one repo to another with history (2021)

10 transpute 1 5/16/2025, 7:23:26 AM vivekdhami.com ↗

Comments (1)

precompute · 1h ago
Here's an dirtier and easier way to do this:

git -C {source_repo} format-patch -{number of commits} HEAD --stdout -- {absolute folder/file path(s)} > /tmp/new.patch

git -C {target_repo} am < /tmp/new.patch

This will "stack" all these commits on top of HEAD.