Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Some steps to extract a changed vendor'd plugin into a branch off of its main repo
# Following instructions found on
# Clone your project repo (making sure to copy all files, even hard links)
git clone --no-hard-links my_app my_active_shipping
cd my_active_shipping
# In your new repo, extract only the commits related to the vendor'd plugin and move that into the new root
git filter-branch --subdirectory-filter vendor/plugins/active_shipping/ HEAD
git reset --hard
# Clean out all of the other commits
git gc --aggressive
git prune
# Remove the old origin to prevent pushing back to the project's repo (optional, but probably want you want)
git remote rm origin
# In another directory, clone the main gem repository (in this case active_shipping)
git clone
cd active_shipping
# Next, find the commit where the plugin diverged (I happened to know it, but you may need to do some forensics). Check it out and start a new branch.
git checkout 684e2e8
git checkout -b my_changes
# Fetch the other repo as a remote (assuming your changes are in master, pull them in as a branch called tmp)
git fetch ../my_active_shipping +master:tmp
git cherry-pick <the commit before your first>..<your last commit in tmp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment