Skip to main content
added 3 characters in body
Source Link
Black
  • 21k
  • 47
  • 188
  • 301

II've added an example based on the answer of @gturri, i hope it helps someone:

I added an example based on the answer of @gturri, i hope it helps someone:

I've added an example based on the answer of @gturri, i hope it helps someone:

cd myRepoRoot
git remote add sub <url_to_submodule>
git fetch sub
git merge sub/master --allow-unrelated-histories

Remove submodule from repo (helps from https://stackoverflow.com/a/1260982/1539100)

rm -rf .git/modules/app/code/Foo/Bar
git config --remove-section submodule.app/code/Foo/Bar
cd myRepoRoot
git remote add sub <url_to_submodule>
git fetch sub
git merge sub/master
cd myRepoRoot
git remote add sub <url_to_submodule>
git fetch sub
git merge sub/master --allow-unrelated-histories

Remove submodule from repo (helps from https://stackoverflow.com/a/1260982/1539100)

rm -rf .git/modules/app/code/Foo/Bar
git config --remove-section submodule.app/code/Foo/Bar
Add syntax highlighting
Source Link
Alexander
  • 63.9k
  • 13
  • 107
  • 177
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ .gitignore
│  │  │  ├─ registration.php
│  │  │  ├─ etc/
│  │  │  │  ├─ modules.xml
│  │  │  ├─ view/
│  │  │  │  ├─ frontend/
│  │  │  │  │  ├─ templates/
│  │  │  │  │  │  ├─ foo.phtml
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ .gitignore
│  │  │  ├─ registration.php
│  │  │  ├─ etc/
│  │  │  │  └─ modules.xml
│  │  │  ├─ view/
│  │  │  │  ├─ frontend/
│  │  │  │  │  ├─ templates/
│  │  │  │  │  │  ├─ foo.phtml
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ .gitignore
│  │  │  ├─ registration.php
│  │  │  ├─ etc/
│  │  │  │  ├─ modules.xml
│  │  │  ├─ view/
│  │  │  │  ├─ frontend/
│  │  │  │  │  ├─ templates/
│  │  │  │  │  │  ├─ foo.phtml
│  │  │  ├─ app/
│  │  │  │  ├─ code/
│  │  │  │  │  ├─ Foo/
│  │  │  │  │  │  ├─ Bar/
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ .gitignore
│  │  │  ├─ registration.php
│  │  │  ├─ etc/
│  │  │  │  └─ modules.xml
│  │  │  ├─ view/
│  │  │  │  ├─ frontend/
│  │  │  │  │  ├─ templates/
│  │  │  │  │  │  ├─ foo.phtml
│  │  │  ├─ app/
│  │  │  │  ├─ code/
│  │  │  │  │  ├─ Foo/
│  │  │  │  │  │  ├─ Bar/
git checkout <target_branch>
git pull
git mv .gitignore registration.php etc/ view/ app/code/Foo/Bar
git commit -am "Moved files"
git push
git checkout <target_branch>
git pull
git mv .gitignore registration.php etc/ view/ app/code/Foo/Bar
git commit -am "Moved files"
git push
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ app/
│  │  │  │  ├─ code/
│  │  │  │  │  ├─ Foo/
│  │  │  │  │  │  ├─ Bar/
│  │  │  │  |  │  │  ├─ .gitignore
│  │  │  │  |  │  │  ├─ registration.php
│  │  │  │  |  │  │  ├─ etc/
│  │  │  │  |  │  │  |  ├─└─ modules.xml
│  │  │  │  |  │  │  ├─ view/
│  │  │  │  |  │  │  |  ├─ frontend/
│  │  │  │  |  │  │  │  |  ├─ templates/
│  │  │  │  |  │  │  |  │  │  ├─ foo.phtml
rm -rf <my_repo_root>/app/code/Foo/Bar
rm -rf <my_repo_root>/app/code/Foo/Bar
cd myRepoRoot
git remote add sub <url_to_submodule>
git fetch sub
git merge sub/master
cd myRepoRoot
git remote add sub <url_to_submodule>
git fetch sub
git merge sub/master
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ .gitignore
│  │  │  ├─ registration.php
│  │  │  ├─ etc/
│  │  │  │  ├─ modules.xml
│  │  │  ├─ view/
│  │  │  │  ├─ frontend/
│  │  │  │  │  ├─ templates/
│  │  │  │  │  │  ├─ foo.phtml
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ .gitignore
│  │  │  ├─ registration.php
│  │  │  ├─ etc/
│  │  │  │  ├─ modules.xml
│  │  │  ├─ view/
│  │  │  │  ├─ frontend/
│  │  │  │  │  ├─ templates/
│  │  │  │  │  │  ├─ foo.phtml
│  │  │  ├─ app/
│  │  │  │  ├─ code/
│  │  │  │  │  ├─ Foo/
│  │  │  │  │  │  ├─ Bar/
git checkout <target_branch>
git pull
git mv .gitignore registration.php etc/ view/ app/code/Foo/Bar
git commit -am "Moved files"
git push
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ app/
│  │  │  │  ├─ code/
│  │  │  │  │  ├─ Foo/
│  │  │  │  │  │  ├─ Bar/
│  │  │  │  |  │  │  ├─ .gitignore
│  │  │  │  |  │  │  ├─ registration.php
│  │  │  │  |  │  │  ├─ etc/
│  │  │  │  |  │  │  |  ├─ modules.xml
│  │  │  │  |  │  │  ├─ view/
│  │  │  │  |  │  │  |  ├─ frontend/
│  │  │  │  |  │  │  │  |  ├─ templates/
│  │  │  │  |  │  │  |  │  │  ├─ foo.phtml
rm -rf <my_repo_root>/app/code/Foo/Bar
cd myRepoRoot
git remote add sub <url_to_submodule>
git fetch sub
git merge sub/master
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ .gitignore
│  │  │  ├─ registration.php
│  │  │  ├─ etc/
│  │  │  │  └─ modules.xml
│  │  │  ├─ view/
│  │  │  │  ├─ frontend/
│  │  │  │  │  ├─ templates/
│  │  │  │  │  │  ├─ foo.phtml
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ .gitignore
│  │  │  ├─ registration.php
│  │  │  ├─ etc/
│  │  │  │  └─ modules.xml
│  │  │  ├─ view/
│  │  │  │  ├─ frontend/
│  │  │  │  │  ├─ templates/
│  │  │  │  │  │  ├─ foo.phtml
│  │  │  ├─ app/
│  │  │  │  ├─ code/
│  │  │  │  │  ├─ Foo/
│  │  │  │  │  │  ├─ Bar/
git checkout <target_branch>
git pull
git mv .gitignore registration.php etc/ view/ app/code/Foo/Bar
git commit -am "Moved files"
git push
app/
├─ code/
│  ├─ Foo/
│  │  ├─ Bar/
│  │  │  ├─ .git/
│  │  │  ├─ app/
│  │  │  │  ├─ code/
│  │  │  │  │  ├─ Foo/
│  │  │  │  │  │  ├─ Bar/
│  │  │  │    │  │  ├─ .gitignore
│  │  │  │    │  │  ├─ registration.php
│  │  │  │    │  │  ├─ etc/
│  │  │  │    │  │    └─ modules.xml
│  │  │  │    │  │  ├─ view/
│  │  │  │    │  │    ├─ frontend/
│  │  │  │    │  │  │    ├─ templates/
│  │  │  │    │  │    │  │  ├─ foo.phtml
rm -rf <my_repo_root>/app/code/Foo/Bar
cd myRepoRoot
git remote add sub <url_to_submodule>
git fetch sub
git merge sub/master
added 14 characters in body
Source Link
Black
  • 21k
  • 47
  • 188
  • 301
Loading
added 14 characters in body
Source Link
Black
  • 21k
  • 47
  • 188
  • 301
Loading
added 46 characters in body
Source Link
Black
  • 21k
  • 47
  • 188
  • 301
Loading
added 46 characters in body
Source Link
Black
  • 21k
  • 47
  • 188
  • 301
Loading
added 30 characters in body
Source Link
Black
  • 21k
  • 47
  • 188
  • 301
Loading
Added pro tip
Source Link
Black
  • 21k
  • 47
  • 188
  • 301
Loading
added 364 characters in body
Source Link
Black
  • 21k
  • 47
  • 188
  • 301
Loading
Source Link
Black
  • 21k
  • 47
  • 188
  • 301
Loading