Skip to content

Instantly share code, notes, and snippets.

@tony
Last active August 3, 2016 04:13
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 tony/55d612825708eb336c5d58031cb7c22f to your computer and use it in GitHub Desktop.
Save tony/55d612825708eb336c5d58031cb7c22f to your computer and use it in GitHub Desktop.
oxygine repo restructure

clone oxygine

❯ git clone https://github.com/oxygine/oxygine-framework oxygine

separate examples into oxygine-examples repo

add remote to new repo

For safety, don't change the original https://github.com/oxygine/oxygine-framework repository

git remote add oxygine-restructure git@github.com:oxygine-restructure/oxygine-framework.git

split examples

❯ git subtree split -P examples -b examples
Created branch 'examples'
1f6a6d8b480b0099986df96f06c03fe31acbce1e

~/study/c++/oxygine master 8s
❯ git checkout examples
Switched to branch 'examples'

~/study/c++/oxygine examples*
❯ git remote add examples git@github.com:oxygine-restructure/oxygine-examples.git

~/study/c++/oxygine examples*
❯ git push examples examples:master
Counting objects: 5675, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2364/2364), done.
Writing objects: 100% (5675/5675), 73.46 MiB | 2.82 MiB/s, done.
Total 5675 (delta 2972), reused 5371 (delta 2870)
To git@github.com:tony/oxygine-examples.git
 * [new branch]      examples -> master

https://github.com/oxygine-restructure/oxygine-examples now has the examples and all history preserved.

filter out history on oxygine-framework

Now remove examples from the oxygine-framework repository itself, this vacuums out any space taken up by examples/ in history

~/study/c++/oxygine examples*
❯ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

~/study/c++/oxygine master
❯ git filter-branch --tree-filter "rm -rf examples" --prune-empty HEAD
Rewrite 1f37ee09955dca40255f1d4d194ddd1c117e86ff (200/486) (70 seconds passed, remaining 100 predicted)
Ref 'refs/heads/master' was rewritten

separate 3rdPartyTools into oxygine-external-tools

~/study/c++/oxygine master
❯ git subtree split -P 3rdPartyTools -b external-tools
Created branch 'external-tools'
8f2fa172d193ccb0482a98e107d46bd1c5261696

~/study/c++/oxygine master 10s
❯ git checkout external-tools
Switched to branch 'external-tools'

~/study/c++/oxygine external-tools*
❯ git remote add oxygine-restructure-external-tools git@github.com:oxygine-restructure/oxygine-external-tools.git

❯ git push oxygine-restructure-external-tools external-tools:master
Counting objects: 1084, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (715/715), done.
Writing objects: 100% (1084/1084), 35.23 MiB | 2.46 MiB/s, done.
Total 1084 (delta 353), reused 998 (delta 326)
To git@github.com:oxygine-restructure/oxygine-external-tools.git
 * [new branch]      external-tools -> master

See https://github.com/oxygine-restructure/oxygine-external-tools

filter out history / space taken up by 3rdPartyTools/

~/study/c++/oxygine external-tools* 18s
❯ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'oxygine-restructure/master'.

~/study/c++/oxygine master
❯ git filter-branch -f --tree-filter "rm -rf 3rdPartyTools" --prune-empty HEAD
Rewrite dc9281bd60d86c6e97439e6c06b76cccd32d9dc3 (461/461) (87 seconds passed, remaining 0 predicted)     `
Ref 'refs/heads/master' was rewritten

split doc/ into oxygine-doc

~/study/c++/oxygine master
❯ git subtree split -P doc -b doc
Created branch 'doc'
f6ab4af07da95370ea5ebdc6de9397d6548c06e1

~/study/c++/oxygine master
❯ git checkout doc
Switched to branch 'doc'

~/study/c++/oxygine doc*
❯ git remote add oxygine-restructure-doc  git@github.com:oxygine-restructure/oxygine-doc.git

~/study/c++/oxygine doc*
❯ git push oxygine-restructure-doc doc:master
Counting objects: 118, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (84/84), done.
Writing objects: 100% (118/118), 21.15 MiB | 2.84 MiB/s, done.
Total 118 (delta 32), reused 103 (delta 32)
To git@github.com:oxygine-restructure/oxygine-doc.git
 * [new branch]      doc -> master

filter out doc/ (save space)

~/study/c++/oxygine doc* 13s
❯ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'oxygine-restructure/master'.

~/study/c++/oxygine master
❯ git filter-branch -f --tree-filter "rm -rf doc doc/* doc.zip" --prune-empty HEAD
Rewrite e57ed784991e6d5611ecda3e94c36a8dd421711a (457/458) (51 seconds passed, remaining 0 predicted)
Ref 'refs/heads/master' was rewritten

separate oxygine/third_party into oxygine-third-party

~/study/c++/oxygine master
❯ git subtree split -P oxygine/third_party -b third-party
Created branch 'third-party'
7a9bbca7c4d36055ea525412fd8c74939b312380

~/study/c++/oxygine master 9s
❯ git checkout third-party
Switched to branch 'third-party'

~/study/c++/oxygine third-party
❯ git remote add oxygine-restructure-third-party git@github.com:oxygine-restructure/oxygine-restructure-third-party.git

~/study/c++/oxygine third-party
❯ git push oxygine-restructure-third-party third-party:master
Counting objects: 1195, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (778/778), done.
Writing objects: 100% (1195/1195), 33.88 MiB | 2.83 MiB/s, done.
Total 1195 (delta 411), reused 1090 (delta 376)
To git@github.com:oxygine-restructure/oxygine-restructure-third-party.git
 * [new branch]      third-party -> master

filter out src/third_party

~/study/c++/oxygine third-party 14s
❯ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'oxygine-restructure/master'.

~/study/c++/oxygine master
❯ git filter-branch -f --tree-filter "rm -rf oxygine/third_party" --prune-empty HEAD
Rewrite 21501e80dd67f416f4734085029b937b8e1cdd20 (455/456) (86 seconds passed, remaining 0 predicted)
Ref 'refs/heads/master' was rewritten

https://github.com/oxygine-restructure/oxygine-restructure-third-party

push cleaned repo back

~/study/c++/oxygine master ⇣⇡ 51s
❯ git push --force oxygine-restructure master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment