[git-users] Git - switching between branches and htdocs folder

2013-12-31 Thread Maciej Reguła
Hi,

I'am new to git and I couldn't find answers anywhere for my questions so 
here I'am.

1. When I create local repository i.e for my own framework and then I 
build websites based on this framwerok, these websties should be different 
branches?

2. I'am web developer, so my projects are stored in htdocs folder. Where 
should be my local repository with master branch localized? In htdocs or 
for example in c:\repos\

3. I want to create different branches of my main framework repository 
because each website will be a little bit different. Some core changes my 
be applied to my framework depending on branch. Let me give you an example. 
I created branch my new website and now I want to work on it so I have to 
download it to my htdocs folder. Can I clone only this branch to htdocs 
folder or should I clone all repository?

4. When I open folder htdocs/my new website and I switch to different 
branch then all files in project are changed. This is pointless for me 
because each project has different vhost config and config files. So when I 
switch to another branch and type in my browser my_new_website.local 
errors will occur. Can I prevent this or I just  cannot switch branches in 
my working copy folders ?

Thanks for help!

-- 
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.


Re: [git-users] Git - switching between branches and htdocs folder

2013-12-31 Thread Konstantin Khomoutov
On Tue, 31 Dec 2013 04:33:22 -0800 (PST)
Maciej Reguła matias...@gmail.com wrote:

 I'am new to git and I couldn't find answers anywhere for my questions
 so here I'am.
 
 1. When I create local repository i.e for my own framework and then
 I build websites based on this framwerok, these websties should be
 different branches?

It depends.

The usual (most common) approach is to consider framework a library and
hence maintain it in a separate repository.  The project which use it
do this by means of Git submodules [1].  If you'll find submodules to
be too heavy-weight or inconvenient, consider using subtree merging [2].

On the other hand, for simple stuff this might be too heavyweight for
no reason.  Simple stuff means your framework is so simple and/or
specialized you will never want to use it for more than one or two
projects so that having it in the same repository as these projects is
okay.  If so, then yes, you might use the ability of Git to create
branches rooted at nowhere (read up on the --orphan option of the
`git branch` command).  Then you might first cook your framework code
on a branch and then create a fresh orphan branch for a project [3] and
then merge your framework into that project branch.  You might then do
integration merges if your framework changes.

Note that should you opt for such multi-branch scheme it worth keeping
the framework in a separate directory or at least not modify its files
heavily in the dependent projets otherwise you'll have merge conflicts
when doing integration merges.  Using submodules or subtree merging
implies this approach anyway.

[...]

Will try to address the other question later -- have no time at the
moment for a comprehensive reply, and terse replies suck.

-- 
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.