Last active
January 6, 2021 15:52
-
-
Save smetana/f57b06303ddd999fbae3b42a947c754c to your computer and use it in GitHub Desktop.
Revisions
-
smetana revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,7 +45,7 @@ git fetch tmp git checkout tmp/master git checkout -b feature/some-lib git rebase -i master git remote remove tmp git gc git prune `` -
smetana revised this gist
Jan 6, 2021 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,13 +32,14 @@ pip3 install git-filter-repo ``` ## Make fresh clone of repo1 and remove remotes git clone https://github.com/you/your-repo.git /home/user/repo1 cd /home/user/repo1 git remote remove origin # Move content of the repo1 root directory to subfolder git filter-repo --to-subdirectory-filter lib # Add local modified repo1 as remote to target repo2, copy history, and rebase cd /home/user/repo1 git remote add tmp /home/user/repo1 git fetch tmp git checkout tmp/master -
smetana revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,8 +38,7 @@ cd /home/user/repo1 # Move content of the repo1 root directory to subfolder git filter-repo --to-subdirectory-filter lib # Add local modified repo1 as remote to target repo2, copy history, and rebase git remote add tmp /home/user/repo1 git fetch tmp git checkout tmp/master -
smetana revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,7 @@ cd /home/user/repo1 # Move content of the repo1 root directory to subfolder git filter-repo --to-subdirectory-filter lib # Add local modified repo1 as remote to target repo2, # copy history, and rebase git remote add tmp /home/user/repo1 git fetch tmp -
smetana revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,7 +28,7 @@ https://github.com/newren/git-filter-repo pip3 install git-filter-repo # or any other method ``` ## Magic ``` ## Make fresh clone of repo1 and remove remotes git clone https://github.com/you/your-repo.git /home/user/repo1 -
smetana revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,8 +29,8 @@ pip3 install git-filter-repo # or any other method ``` ``` ## Make fresh clone of repo1 and remove remotes git clone https://github.com/you/your-repo.git /home/user/repo1 git remote remove origin cd /home/user/repo1 -
smetana revised this gist
Jan 6, 2021 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,14 +13,15 @@ repo2 We will move content and history of repo1 to lib directory of repo2 ## After ``` repo2 |--.git |--.gitignore |-- lib |--.gitignore |--repo1_files |--repo2_files ``` ## Tools needed https://github.com/newren/git-filter-repo ``` -
smetana revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ repo2 |--.gitignore |--repo2_files ``` We will move content and history of repo1 to lib directory of repo2 ## After repo2 -
smetana revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ repo2 |--.gitignore |--repo2_files ``` We will move content and history of repo1 to lib directory of repo1 ## After repo2 -
smetana revised this gist
Jan 6, 2021 . 2 changed files with 50 additions and 52 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,52 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ ## Before ``` repo1 |--.git |--.gitignore |--repo1_files repo2 |--.git |--.gitignore |--repo2_files ``` ## We will move content and history of repo1 to lib directory of repo1 ## After repo2 |--.git |--.gitignore |-- lib |--.gitignore |--repo1_files |--repo2_files ## Tools needed https://github.com/newren/git-filter-repo ``` pip3 install git-filter-repo # or any other method ``` ## Make fresh clone of source repository and remove remote ``` git clone https://github.com/you/your-repo.git /home/user/repo1 git remote remove origin cd /home/user/repo1 # Move content of the repo1 root directory to subfolder git filter-repo --to-subdirectory-filter lib # Add local modified repo as remote to target repo, # copy history, and rebase git remote add tmp /home/user/repo1 git fetch tmp git checkout tmp/master git checkout -b feature/some-lib git rebase -i master git remote remove tmp git gc `` -
smetana created this gist
Jan 6, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ ## Before ``` repo1 |--.git |--.gitignore |--files repo2 |--.git |--.gitignore |--files ``` ## After repo1 |--.git |--.gitignore |-- repo2 |--.git |--.gitignore |--files |--files ## Tools needed https://github.com/newren/git-filter-repo ``` pip3 install git-filter-repo # or any other method ``` ## Make fresh clone of source repository and remove its remotes ``` mkdir /home/user/repo1 cd /home/user/repo1 git clone https://github.com/you/your-repo.git git remote remove origin # Move content of the source repo root directory to subfolder # (as it will be in target repo) git filter-repo --to-subdirectory-filter lib/some-lib # Add local modified repo as remote to target repo, # copy history, and rebase git remote add side-repo /home/user work git fetch side-repo git checkout side-repo/master git checkout -b feature/some-lib git rebase -i master git remote remove side-repo git gc ``