-
Notifications
You must be signed in to change notification settings - Fork 2
Importing
Georg Pfuetzenreuter edited this page May 12, 2023
·
1 revision
To import a formulas repository into a formulas subdirectory in this repository, use:
$ cp my-formula my-formula-subtree
$ cd my-formula-subtree
# checkout/pull to the point you want to import from
$ git filter-branch --prune-empty --tree-filter '
if [ ! -d my-formula ]; then
mkdir my-formula
git ls-tree --name-only $GIT_COMMIT | xargs -I files mv files my-formula/
fi'
# will warn you, hence the backup copy earlier
$ cd ../salt-formulas
# checkout/pull to the point you want to import to
$ git checkout -b import/my-formula-base
$ git remote add my-formula-origin ../my-formula-subtree
$ git fetch my-formula-origin
$ git rebase --rebase-merges --onto import/my-formula-base --root my-formula-origin/<branch you used earlier>
$ git checkout -b import/my-formula-subtree
$ git checkout main
$ git checkout -b import/my-formula
$ git merge import/my-formula-subtree
$ git branch -d import/my-formula-subtree
$ git branch -d import/my-formula-base
Verify the expected result with git log --format=fuller my-formula
from the repository root.