- We want to move all files under
library/hott
inleanprover/library
repo tosrc/library/hott
inleanprover/lean
repo. - We want to preserve the commit history of
leanprover/library
during the migration.
I assume that leanprover/lean
repo is already cloned at ~/work/lean
.
-
Add
leanprover/libraries
repo as a remote.cd ~/work/lean git remote add libs [email protected]:leanprover/libraries git fetch libs
-
Create a local branch
libs
based onlibs/master
.git co -b libs libs/master
-
Extract files under
library/hott
and move them tosrc/library/hott
.
First, please save the following script as extract_and_move
.
```bash
#!/usr/bin/env bash
if [ ! $# -eq 2 ] then echo "./extract_and_move " exit 1 fi SRC=$1 DEST=$2 DEST_FIRST=${DEST%%/*}
git filter-branch -f --prune-empty --subdirectory-filter $SRC -- HEAD
git filter-branch -f --prune-empty --tree-filter "mkdir -p
and use:
extract_and_move library/hott src/library/hott
-
Switch back to
master
branchgit co master
-
Take commits in
libs
branch on top ofmaster
by rebase.git rebase --onto libs master master