i'm looking best practice working git. here problem:
i have base project and, each client, clone it. because projects similar (only changes config files , images), , each web project stored in different directory.
so think best practice clone base project, make changes , upload new clients dir.
until here fine but: how merge changes if found critical bug or if add new feature (or some) of projects? need create patch or similar? how?
i like, if please, easy understanding answer, because not git master (but want learn!)
thank much!
you might want weigh options depending on changes in base repository (client repositories) want incorporate in some/all of client repositories(base repository).
assume want changes incorporated client , changes want in base. let's have remote points base repository. so, in client repo, would:
git remote add basepro <url>
here cases might encounter:
you make basic change/ major bug fix in base repository want incorporated in all/some of clients. in case base repository local , rewriting commit history doesn't affect in anyway, can consider rebase:
git rebase -i basepro/master
this take last common commit of base project , client project , apply commits have made client project 1 one. but, might have manually merge few changes here , there , continue:
git rebase --continue
rebase friend if want commit history if have feature in base before started working on changes specific client. in other client projects, might rebase branch want or specific commits want rebased from.
you want specific commits in base repository applied client repositories or specific commits of 1 client applied another.
git cherry-pick -xpatience <commit>
you can specify range of commits.
you have similar files in client1 , client2, , both based on file in base. now, want merge these files in 2 clients client 3.
in case, might want use
git merge-file <client1file> <basefile> <client2file>
the merged file written
client1file
. in case, have firstcheckout
required files working tree, when in client 3 repo.git checkout baserepo/master -- basefile
would checkout basefile.
you rely on
git merge
in case base has features want in clients , wouldn't affect independent development of client or in other case want branch merged in current branch directly. might want use ours strategy keep client repo's changes in case of conflicts or manual fix, sure.git merge -s ours baserepo/master
applying patches can done explained me in this answer:
Comments
Post a Comment