Git Submodule

From Chorke Wiki
Revision as of 05:30, 12 December 2019 by Shahed (talk | contribs) (Created page with "<source lang="bash"> /opt/chorke/academia ├─ master │ ├─ AcademiaApi │ ├─ AcademiaGui │ └─ AcademiaApp ├─ server │ ├─ ac...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
 /opt/chorke/academia
   ├─ master
     ├─ AcademiaApi
     ├─ AcademiaGui
     └─ AcademiaApp
   ├─ server
     ├─ academia-init-rmsapi.git
     ├─ academia-init-rmsapi.git
     └─ academia-init-rmsapi.git
   └─ client
      ├─ AcademiaApi
      ├─ AcademiaGui
      └─ AcademiaApp


# server side
cd  /opt/chorke/academia/server/
git init --bare academia-init-rmsapi.git
git init --bare academia-init-rmsgui.git
git init --bare academia-init-rmsapp.git


# master/api
cd  /opt/chorke/academia/master/AcademiaApi
   ├─ .gitignore
   ├─ LICENSE
   └─ README.md


git init
git remote add origin /opt/chorke/academia/server/academia-init-rmsapi.git
git add --all;git commit -m 'initial commit'


# master/gui
cd  /opt/chorke/academia/master/AcademiaGui
   ├─ .gitignore
   ├─ LICENSE
   └─ README.md

git init
git remote add origin /opt/chorke/academia/server/academia-init-rmsgui.git
git add --all;git commit -m 'initial commit'


# master/app
cd  /opt/chorke/academia/master/AcademiaApp
   ├─ .gitignore
   ├─ LICENSE
   └─ README.md

git init
git remote add origin /opt/chorke/academia/server/academia-init-rmsapp.git
git add --all;git commit -m 'initial commit'


# master/sub
git submodule add /opt/chorke/academia/server/academia-init-apigui.git
git submodule add /opt/chorke/academia/server/academia-init-rmsgui.git

git rm --cached .gitmodules
git rm --cached academia-init-rmsapi
git rm --cached academia-init-rmsgui

git clean -fd;git reset --hard
rm -rf academia-init-rms*


git submodule add /opt/chorke/academia/server/academia-init-rmsapi.git AcademiaApi
git submodule add /opt/chorke/academia/server/academia-init-rmsgui.git AcademiaGui
git commit -m 'academia-ruap-{rmsapi,rmsgui} added'
git push origin master


# client/app
cd  /opt/chorke/academia/client/
git clone /opt/chorke/academia/server/academia-init-rmsapp.git AcademiaApp
cd AcademiaApp/


# client/sub
cd  /opt/chorke/academia/client/AcademiaApp/
git submodule init
git submodule update


# client/gui
cd  /opt/chorke/academia/client/AcademiaApp/AcademiaGui/
vim HelloGui.txt
cd ..


# client/app
vim HelloApp.txt
git add --all;git commit -m 'Hello App Added'
git status


# client/gui
cd AcademiaGui/
git add --all;git commit -m 'Hello Gui Added'
git status
cd ..


# client/app
git status
git submodule status --recursive

git submodule foreach git push -u origin master
git submodule foreach git pull origin master

# master/gui
cd  /opt/chorke/academia/master/AcademiaGui/
git pull origin master

# client/sub/gui
cd  /opt/chorke/academia/client/AcademiaApp/AcademiaGui/
git checkout master
vim HelloGui.txt
git add --all;git commit -m 'Hello GUI Added'
git push origin master
cd ..

# client/app
git add AcademiaGui
git commit -m 'AcademiaGui updated'
git push origin master

git config -f .gitmodules submodule.AcademiaApi.branch master
git config -f .gitmodules submodule.AcademiaGui.branch master

# master/gui
cd  /opt/chorke/academia/master/AcademiaGui/
vim HelloAdd.txt
git add HelloAdd.txt;git commit -m 'Hello Add Text File Added'
git push origin master

# client/sub/gui
cd  /opt/chorke/academia/client/AcademiaApp/AcademiaGui/
git pull origin master
cd ..

# client/app
git status
git add AcademiaGui
git commit -m 'AcademiaGui updated'
git push origin master

# master/gui
cd  /opt/chorke/academia/master/AcademiaApp/
git submodule foreach git pull origin master
git pull origin master