Last active
December 11, 2023 15:28
-
-
Save justinmassiot/79303df733c286f831f968d35fe1a443 to your computer and use it in GitHub Desktop.
Instructions to export a subdirectory to a new git repository and keep the history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://ao.gl/how-to-split-a-subdirectory-to-a-new-git-repository-and-keep-the-history/ | |
git filter-branch --prune-empty --subdirectory-filter relative/path/to/subdirectory your_current_branch_name | |
git remote set-url origin https://github.com/subfolder/your_new_sub_repo.git | |
git push -u origin your_current_branch_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment