Output looks like below:
We are grouping multiple git repository under single git repository using SubModules concept.
Each submodule is a git repository.
Steps:
Step 1: Create each git repository in GIT
- galleyiq-frontend-frontend
- galleyiq-scm-crm-scm-crm
- galleyiq-gms-customerportal-gms-customer
- galleyiq-lms-partner-lms-partner
Step 2: Add sample data in the repositories and commit.
cd galleyiq-frontend-frontend
echo "# GalleyIQ Frontend" > README.md
git add README.md
git commit -m "Initial commit"
git push origin main
Step 3: Create the meta‑repo
Create new repository in git named galleyiq-meta
In your local machine run below command
mkdir galleyiq-meta
cd galleyiq-meta
git init
git branch -M main
git remote add origin https://github.com/BharathanBtech/galleyiq-meta.git In galleyiq-meta, run below commands to add the repository as sub modules.
git submodule add https://github.com/yourorg/galleyiq-frontend frontend
git submodule add https://github.com/yourorg/galleyiq-scm-crm scm-crm
git submodule add https://github.com/yourorg/galleyiq-gms-customerportal gms-customer
git submodule add https://github.com/yourorg/galleyiq-lms-partner lms-partner
Commit and push galleyiq-meta repository by running below command
git commit -m "feat: Added submodules"
git push -u origin main
If a new team member clones this meta repository needs to clone the repo and run the below command
git submodule update --init --recursive
Reason: if you clone, the repository will be empty.. After ran this command only git will pull
the latest code from the remote.
If the submodule commit is 10 and meta repo points to 7 means, running this command will get
7th commit code only not 10.
To get 10th commit, we have to pull the latest code on each submodule and add that to the meta repo.
git commit -m "Add submodules"
git commit -m "Add submodules"
git commit -m "Add submodules"
No comments:
Post a Comment