Skip to content

Instantly share code, notes, and snippets.

@ldemailly
Last active May 23, 2024 23:36
Show Gist options
  • Save ldemailly/ff9e6cab1af1b040ecccf870acab7586 to your computer and use it in GitHub Desktop.
Save ldemailly/ff9e6cab1af1b040ecccf870acab7586 to your computer and use it in GitHub Desktop.
Import partial directories into another repo

using https://github.com/newren/git-filter-repo

mkdir import_tmp; cd import_tmp
wget https://raw.githubusercontent.com/newren/git-filter-repo/main/git-filter-repo # get the code
git clone https://github.com/fortio/fortio # the source repo
cd fortio/
python3 ../git-filter-repo --path fhttp --path fgrpc --path-rename 'fhttp:legacy/fhttp' --path-rename 'fgrpc:legacy/fgrpc'
ls legacy # works!

# on the target:
cd ../destination_history_import/
git remote add import_remote ../fortio # the source
git switch -c import # where to push
git fetch import_remote
git merge import_remote/master --allow-unrelated-histories
# git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment