github - Maintaining Git repo inside another git repo -


i have git repo contains in angularjs web app.

it has subfolder called build gets created gulp task. deploying azure connected directly bitbucket directory.

i want make build folder separate git repo azure app being deployed. how achieve in git ??

you have several options like:

  • submodule
  • subtree

submodules allow foreign repositories embedded within dedicated subdirectory of source tree, pointed @ particular commit.


git submodule

break big project sub projects did far.
add each sub project main project using :

git submodule add <url> 

once projected added tot repo have init , update it.

git submodule init git submodule update 

as of git 1.8.2 new option --remote added

git submodule update --remote --merge 

will fetch latest changes upstream in each submodule, merge them in, , check out latest revision of submodule.

as the docs describe it:

--remote

this option valid update command. instead of using superproject’s recorded sha-1 update submodule, use status of submodule’s remote-tracking branch.

this equivalent running git pull in each submodule.


however, how push commit in scenario of bug fix in c affects code shared parent layers?

again: using submodule place code inside main project part of content. difference between having locally inside folder or having part of submodule in submodule content managed (commited) different standalone repository.


this illustration of submodule - project inside project in each project standalone project.

enter image description here


git subtree

git subtree allows insert repository sub-directory of one

very similar submodule main difference code managed. in submodules content placed inside separate repo , managed there allow clone many other repos well.

subtree managing content part of root project , not in separate project.

instead of writing down how set , understand how use can read excellent post explain all.

https://developer.atlassian.com/blog/2015/05/the-power-of-git-subtree/


Comments