git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Two versions of a project in one GIT repository
@ 2010-01-08  1:06 Kacper
  2010-01-08  3:57 ` Dmitry Potapov
  0 siblings, 1 reply; 2+ messages in thread
From: Kacper @ 2010-01-08  1:06 UTC (permalink / raw)
  To: git


Hi all,

I have two versions of one project in one local git repository. I have to
commit this repository into 2 remote repositories, one for each version;

LOCAL GIT(V1/V2) -> REMOTE GIT(V1), REMOTE GIT(V2)

I have some files in the LOCAL GIT repository which should only go to REMOTE
GIT(V1) and other should only go to REMOTE GIT(V2). Now I commit full local
repository to both remotes. Can I only commit some files to REMOTE1?

I need to have both version of the project in one repository, but would like
to have an options to divide history a bit. I do not think that any
branching can help as then I would have to make the same changes to both
branches mostly. Most of the code, 90% of the code is the same for VER 1 and
VER 2. New code is usually the same for both versions.

THANK YOU,

Kacper

-- 
View this message in context: http://n2.nabble.com/Two-versions-of-a-project-in-one-GIT-repository-tp4269785p4269785.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Two versions of a project in one GIT repository
  2010-01-08  1:06 Two versions of a project in one GIT repository Kacper
@ 2010-01-08  3:57 ` Dmitry Potapov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Potapov @ 2010-01-08  3:57 UTC (permalink / raw)
  To: Kacper; +Cc: git

On Thu, Jan 07, 2010 at 05:06:34PM -0800, Kacper wrote:
>
> I have two versions of one project in one local git repository. I have to
> commit this repository into 2 remote repositories, one for each version;
>
> LOCAL GIT(V1/V2) -> REMOTE GIT(V1), REMOTE GIT(V2)
>
> I have some files in the LOCAL GIT repository which should only go to REMOTE
> GIT(V1) and other should only go to REMOTE GIT(V2). Now I commit full local
> repository to both remotes. Can I only commit some files to REMOTE1?

You do not commit to any remote. You _always_ commit to the local repository.
Then using 'git push', you propagate your changes, and you can propagate any
commit to any remote repository of your choice, but you can only to push the
_whole_ commit, which implies the whole tree and all parents commits as well.

> I need to have both version of the project in one repository, but would like
> to have an options to divide history a bit.

You can add as many remote repository as you like using 'git remote add'.

> I do not think that any
> branching can help as then I would have to make the same changes to both
> branches mostly. Most of the code, 90% of the code is the same for VER 1 and
> VER 2. New code is usually the same for both versions.

You can commit only to one branch and then merge your changes to another. In
general case, you may want to have a special branch to commit common changes
and then to merge it to V1 and V2. Though, I guess it is a bit inconvinient.

However, if the difference between V1 and V2 is not large, and you do mind
having V1 history visible as part of V2 history then you may have just two
branches. You create V2 based on V1, by adding V2 specific files and removing
V1 specific files. After that you made all your work on V1 and periodically
merge V1 to V2. Changes made to V1 specific files will cause conflict during
merge to V2, but you can easily resolve by doing 'git rm' on V1 specific
files.

To better understand Git model, I suggest you read "Git for Computer
Scientists" http://eagain.net/articles/git-for-computer-scientists/


Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-08  3:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-08  1:06 Two versions of a project in one GIT repository Kacper
2010-01-08  3:57 ` Dmitry Potapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).