Skip to content

Instantly share code, notes, and snippets.

@kenoir
Last active June 10, 2020 15:53
Show Gist options
  • Save kenoir/7fbb42f6b79d52a31a0b395811317f3a to your computer and use it in GitHub Desktop.
Save kenoir/7fbb42f6b79d52a31a0b395811317f3a to your computer and use it in GitHub Desktop.
# Checkout a fresh copy of the repo you want to pull the code from
git clone [email protected]:wellcomecollection/scala-SOMELIB.git
# Move into the freshly checked repo
cd scala-SOMELIB
# Filter history for a particular directory
git filter-branch --subdirectory-filter SOMELIB -- --all
# Rearrange things as you'd like them
# - Ensure things have a suitable folder name at this point
# - Commit that change
mkdir SOMELIB
mv src SOMELIB
git add SOMELIB
git commit -m "move to SOMELIB"
# Add the new repo as an origin
git remote set-url origin [email protected]:wellcomecollection/scala-libs.git
# Merge the new repo history
git pull origin master --allow-unrelated-histories
# Push the history back to master
git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment