Re: [git-users] Git Puzzle: Managing multiple websites based on the same code

2013-06-22 Thread Sam Roberts
On Tue, Jun 18, 2013 at 2:42 PM, Dyske Suematsu  wrote:
> Currently I manage them with SVN. The original, generic site is in the
> "trunk" and for each new client, I create a branch. If I make a change to
> the trunk that needs to be propagated to all the branches/sites, I just run
> svn merge to merge trunk into branches. I've been doing this for some years
> and it's been working fine.

Do the same thing in git, works fine, its just you can't do a single
clone, and get the trunk and all branches and everything checked out
at the same time. Clone multipe times:

mkdir SITE
cd SITE
for every customer A, B, C
  git clone REPO.git A&& cd A && git checkout origin/A

now you have basically the same thing.

You could do this with different github projects, if for some reason
you wanted your customers to see only a single git repository named
after them, but behind the scenes you would make them all be branchs
of the same code base. The way to do it is to NOT use github's fork
button. Instead, have a main repo, MAIN.git, then make a new one for
each customer A.git, B.git, etc. You would then manage each
independently, using cmd line tools, instead of the github web UI,
pushing and pulling and merging between them.

> Another suggestion, which is obvious but would not work, is to create a
> branch for each website. This wouldn't work because the concept of "branch"
> in Git is almost completely different from SVN. Git does not create a
> separate directory for each branch; it just switches the same directory. So,
> if you have 20 websites, you would have to constantly switch between
> different websites and you could never pull up two sites side-by-side on
> your local machine. Furthermore, websites these days have files and folders

For some reason you seem to be stuck on the notion you can only do a
single git clone on your machine, and you have to do all your work in
that single clone... this isn't even true with svn, I usually have a
svn checkout from root that I sporadically keep up to date, but then
in my working directory I have multiple checkouts of  my projects
trunk, under different names,for different bits of work I'm doing.

So just clone the repo multiple times. You can even recreate the svn
directory structure locally if it makes you feel good:

mkdir -p REPO REPO/branches
cd REPO; git clone repo.git -t master
cd branches; for A, B, C
   git clone ...; git checkout branch ...

> Submodules and Subtree are two other suggestions but these would require me

Stay away from them.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[git-users] Git Puzzle: Managing multiple websites based on the same code

2013-06-18 Thread Dyske Suematsu
Hi All,

I spent a whole week researching this and found no answer. So, I'm hoping 
that someone here could help me. Here's my situation which I don't think is 
so unique or strange.

I have a generic website that I always use as my starting point to build 
websites for all of my clients. Since each client's needs are different, I 
end up editing different parts of the original code. (In other words, I 
cannot separate and isolate files that all sites share in common.) As you 
could imagine, without some sort of version control, it would be very 
difficult to manage all the websites. The same fix/change would have to be 
applied to all the sites individually.

Currently I manage them with SVN. The original, generic site is in the 
"trunk" and for each new client, I create a branch. If I make a change to 
the trunk that needs to be propagated to all the branches/sites, I just run 
svn merge to merge trunk into branches. I've been doing this for some years 
and it's been working fine.

Now, I would like to switch to Git because it's more powerful overall, but 
I cannot figure out how I can manage these sites with Git. I searched this 
Google Group and found someone who asked a similar question. I also asked 
some of my programmer friends who have been using Git for a long time. They 
all suggested to create a fork for each website. I thought it would work, 
so I started implementing this but hit a wall. The issue is that on Github, 
each fork requires a unique user. Say, I create the "Official" repo under 
my "Organization" account. The URL would be:

https://github.com/mycompany/basesite

I then create a fork of this, and I would end up with:

https://github.com/username/basesite

Now, if I want to create another site, I would have to create a new user 
because each fork is differentiated only by the user name. If I have to 
create a new user for each website, eventually, I'll end up with a whole 
bunch of user accounts to manage. And, since this must be a private repo, 
each user would cost $7 a month and it can quickly amount to thousands of 
dollars a year. So, this strategy hit a wall here.

Another suggestion, which is obvious but would not work, is to create a 
branch for each website. This wouldn't work because the concept of "branch" 
in Git is almost completely different from SVN. Git does not create a 
separate directory for each branch; it just switches the same directory. 
So, if you have 20 websites, you would have to constantly switch between 
different websites and you could never pull up two sites side-by-side on 
your local machine. Furthermore, websites these days have files and folders 
that the users upload (like photos). You wouldn't want to put them into the 
repo but you do need them to switch when you change from one website to 
next. Managing all this would be confusing and difficult under the same 
working directory.

Submodules and Subtree are two other suggestions but these would require me 
to separate and isolate the files that are common to all sites. As I said 
above, I cannot do this because each client has different needs.

I don't think my situation is so uncommon. It's a situation where you spin 
off a bunch of different versions from the same original codebase and each 
is a legitimate product of its own (not a temporary state to be discarded 
or merged at some point). Git is a powerful and flexible tool, so I'm 
thinking that there HAS TO BE a solution for this. If anyone has any idea, 
I would appreciate it very much (I would buy you lunch if you are in New 
York).

Thank you,
Dyske

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.