Skip to content

Instantly share code, notes, and snippets.

@VineetReynolds
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VineetReynolds/2294339ef11dfad95c5a to your computer and use it in GitHub Desktop.
Save VineetReynolds/2294339ef11dfad95c5a to your computer and use it in GitHub Desktop.
# Based on http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
# with some amendments
# create a new branch in WFK quickstarts
git checkout -b kitchensink-html5-mobile
# For kitchensink-html5-mobile, in wfk-quickstarts
# the following command filters out only the kitchensink-html5-mobile dir, and retains it's contents in the root dir
git filter-branch -f --subdirectory-filter kitchensink-html5-mobile -- --all
# Recreate the sub-directory structure.
# See http://stackoverflow.com/questions/7383117/git-subdirectory-filter-with-existing-directory-structure
# This is an amendment on the original article
git filter-branch -f --index-filter 'git ls-files -s \
| sed "s-\t-&kitchensink\-html5\-mobile/-" \
| GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info \
&& mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE'
# Then, in the jboss-eap quickstarts, add the wfk-quickstarts repo, and rebase the changes on the development branch
git remote add wfk <wfk repository directory>
git fetch wfk
git checkout -b rebase-branch wfk/kitchensink-html5-mobile
# Finally, rebase the changes on master or develop branch
git rebase 7.0.x-develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment