{"thread":{"id":"22127","subject":"Two versions of a project in one GIT repository","startedAt":"2010-01-08T01:06:34Z","lastAt":"2010-01-08T03:57:29Z","messageCount":2,"participants":["Kacper","Dmitry Potapov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"131056","messageId":"1262912794001-4269785.post@n2.nabble.com","threadId":"22127","inReplyTo":null,"subject":"Two versions of a project in one GIT repository","fromName":"Kacper","fromEmail":"kacper.gazda@gmail.com","sentAt":"2010-01-08T01:06:34Z","receivedAt":"2010-01-08T01:06:34Z","isPatch":false,"sender":{"key":"kacper.gazda@gmail.com","avatar":null},"body":"\nHi all,\n\nI have two versions of one project in one local git repository. I have to\ncommit this repository into 2 remote repositories, one for each version;\n\nLOCAL GIT(V1/V2) -> REMOTE GIT(V1), REMOTE GIT(V2)\n\nI have some files in the LOCAL GIT repository which should only go to REMOTE\nGIT(V1) and other should only go to REMOTE GIT(V2). Now I commit full local\nrepository to both remotes. Can I only commit some files to REMOTE1?\n\nI need to have both version of the project in one repository, but would like\nto have an options to divide history a bit. I do not think that any\nbranching can help as then I would have to make the same changes to both\nbranches mostly. Most of the code, 90% of the code is the same for VER 1 and\nVER 2. New code is usually the same for both versions.\n\nTHANK YOU,\n\nKacper\n\n-- \nView this message in context: http://n2.nabble.com/Two-versions-of-a-project-in-one-GIT-repository-tp4269785p4269785.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"131066","messageId":"20100108035729.GB28263@dpotapov.dyndns.org","threadId":"22127","inReplyTo":"1262912794001-4269785.post@n2.nabble.com","subject":"Re: Two versions of a project in one GIT repository","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2010-01-08T03:57:29Z","receivedAt":"2010-01-08T03:57:29Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Thu, Jan 07, 2010 at 05:06:34PM -0800, Kacper wrote:\n>\n> I have two versions of one project in one local git repository. I have to\n> commit this repository into 2 remote repositories, one for each version;\n>\n> LOCAL GIT(V1/V2) -> REMOTE GIT(V1), REMOTE GIT(V2)\n>\n> I have some files in the LOCAL GIT repository which should only go to REMOTE\n> GIT(V1) and other should only go to REMOTE GIT(V2). Now I commit full local\n> repository to both remotes. Can I only commit some files to REMOTE1?\n\nYou do not commit to any remote. You _always_ commit to the local repository.\nThen using 'git push', you propagate your changes, and you can propagate any\ncommit to any remote repository of your choice, but you can only to push the\n_whole_ commit, which implies the whole tree and all parents commits as well.\n\n> I need to have both version of the project in one repository, but would like\n> to have an options to divide history a bit.\n\nYou can add as many remote repository as you like using 'git remote add'.\n\n> I do not think that any\n> branching can help as then I would have to make the same changes to both\n> branches mostly. Most of the code, 90% of the code is the same for VER 1 and\n> VER 2. New code is usually the same for both versions.\n\nYou can commit only to one branch and then merge your changes to another. In\ngeneral case, you may want to have a special branch to commit common changes\nand then to merge it to V1 and V2. Though, I guess it is a bit inconvinient.\n\nHowever, if the difference between V1 and V2 is not large, and you do mind\nhaving V1 history visible as part of V2 history then you may have just two\nbranches. You create V2 based on V1, by adding V2 specific files and removing\nV1 specific files. After that you made all your work on V1 and periodically\nmerge V1 to V2. Changes made to V1 specific files will cause conflict during\nmerge to V2, but you can easily resolve by doing 'git rm' on V1 specific\nfiles.\n\nTo better understand Git model, I suggest you read \"Git for Computer\nScientists\" http://eagain.net/articles/git-for-computer-scientists/\n\n\nDmitry\n"}]}