using a smaller project as a git submodule in several other projects - can't make it work -
i've seen question crop more once in 1 form or around here, made me choose route. have smallish project (web stuff) has own gruntfile , git repository , under active development. use result of development in several other projects, is, don't want or need gruntfile or sass files etc. however, if there's update in shared project, want able pull , merge updates files in current project. want make modifications these files adapt them current project's needs.
the way understand is, should make git submodule in other project want have these files. must new git, far i've been using few personal projects - , loving -, nothing collaborative (so no pulling , merging yet), , feel still don't have grasp on it.
anyway added shared project (let's call sub) submodule in project i'm working on (let's call a). sub exists folder in a, , git status
lists folder modified
. doing git add sub/
not change this. , doing git merge sub/
nets me merge: sub/ - not can merge
. ?? how updated files sub a? or going wrong way? found subtree merge strategy on somewhere, maybe more suitable?
i'm using git v2.1.4, afaik there have been changes git submodule in v 2.10.1 - not sure if problem.
so first, a
, sub
2 different repos own life.
from point of view of a
, sub
reference/link specific commit in sub
.
when change in sub
, need commit these changes:
$ cd sub/ $ git commit -a -m "improve sub framework loading times" [master f78dc91] improve sub framework loading times" 10 files changed, 228 insertions(+), 28 deletions(-) $ git push
so you've added new commit (f78dc91
) sub
, can go a
, enter:
$ cd .. $ git status on branch master branch up-to-date 'origin/master'. changes not staged commit: (use "git add <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) modified: sub (new commits)
the need git add
these sub
changes (i.e. reference new commit f78dc91
):
$ git add sub on branch master branch up-to-date 'origin/master'. changes committed: (use "git reset head <file>..." unstage) modified: sub
and commit:
$ git commit -m "a uses new version of sub improving loading times." $ git push
so see, committing , pushing changes in sub
, , integrating these changes in a
2 independent actions need perform if want a
changes.
other comments
git merge sub/
you can merge references, means commits, branches , tags (and references of a
repo) command not make sense. (you can't merge file or directory)
Comments
Post a Comment