* Re: Multiple checkouts active for the same repository
2010-09-24 9:29 Multiple checkouts active for the same repository Gustavo Narea
@ 2010-09-24 11:55 ` Gustavo Narea
2010-09-24 13:07 ` Ævar Arnfjörð Bjarmason
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Gustavo Narea @ 2010-09-24 11:55 UTC (permalink / raw)
To: git
I guess it all comes down to one thing: How can I avoid Git's feature of
making only one branch/checkout active at a time under the same path?
I need to have the branches and their checkouts on different
directories, and it seems like the only way to do it is having one
repository per branch/checkout, which doesn't look like the ideal way of
doing things in Git.
Apart from the situation I describe in the initial email, there's
another limitation in the development environment: Our IDE, Eclipse +
Pydev, assumes each project (i.e., branch/checkout) to be on different
directories and each project should have different settings (e.g., paths
to dependencies, which could be different), but with GIt everything
would be a single project because it's all on the same path.
Thanks in advance.
- Gustavo.
On 24/09/10 10:29, Gustavo Narea wrote:
> Hello.
>
> We're currently migrating from another DVCS, which allows us to have
> working copies of each branch in separate directories, so that their
> code can be used simultaneously. However, I haven't found a way to do
> this with Git, at least not an easy way. Can you please help me?
>
> We are a team of Web developers and testers working on an application.
> There are always a few development branches and a stable branch, and
> testers need all the branches with the very latest code available at all
> times.
>
> The way we handle it at the moment is very simple because the server
> hosting the remote repository is the same that hosts the deployed
> instances of each branch, so when we push to the remote repository, the
> code for each site is automatically updated.
>
> We use the following structure:
> /srv/repositories/project/branch1
> /srv/repositories/project/branch2
> /srv/repositories/project/branch3
>
> Is there any simple way to do this with Git? I can only think of two
> options that involve hooks:
>
> * Have a hook that exports each branch to a directory like
> /srv/repositories/project/branchN
> * Have one Git repository per branch, so that each repository have a
> different checkout active. Then the main remote repository will
> have post-receive hooks that trigger a pull on each individual
>
> I'm not particularly happy with either way. Is there a better solution?
>
--
Gustavo Narea.
Software Developer.
2degrees, Ltd. <http://dev.2degreesnetwork.com/>.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Multiple checkouts active for the same repository
2010-09-24 9:29 Multiple checkouts active for the same repository Gustavo Narea
2010-09-24 11:55 ` Gustavo Narea
@ 2010-09-24 13:07 ` Ævar Arnfjörð Bjarmason
2010-09-24 14:42 ` Gustavo Narea
2010-09-24 15:33 ` Julian Phillips
2010-09-24 15:57 ` Jakub Narebski
3 siblings, 1 reply; 9+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-09-24 13:07 UTC (permalink / raw)
To: Gustavo Narea; +Cc: git
On Fri, Sep 24, 2010 at 09:29, Gustavo Narea
<gnarea@tech.2degreesnetwork.com> wrote:
> We're currently migrating from another DVCS.
Which one?
> We are a team of Web developers and testers working on an application.
> There are always a few development branches and a stable branch, and
> testers need all the branches with the very latest code available at all
> times.
>
> The way we handle it at the moment is very simple because the server
> hosting the remote repository is the same that hosts the deployed
> instances of each branch, so when we push to the remote repository, the
> code for each site is automatically updated.
>
> We use the following structure:
> /srv/repositories/project/branch1
> /srv/repositories/project/branch2
> /srv/repositories/project/branch3
>
> Is there any simple way to do this with Git? I can only think of two
> options that involve hooks:
>
> * Have a hook that exports each branch to a directory like
> /srv/repositories/project/branchN
> * Have one Git repository per branch, so that each repository have a
> different checkout active. Then the main remote repository will
> have post-receive hooks that trigger a pull on each individual
>
> I'm not particularly happy with either way. Is there a better solution?
If you really need this the best solution is to just `git clone` the
project multiple times and check out each branch in its own dir. Then
have some shellscript to update them all.
But just using the Git workflow would be better.
> Apart from the situation I describe in the initial email, there's
> another limitation in the development environment: Our IDE, Eclipse +
> Pydev, assumes each project (i.e., branch/checkout) to be on different
> directories and each project should have different settings (e.g., paths
> to dependencies, which could be different), but with GIt everything
> would be a single project because it's all on the same path.
Can't you just modify your build environment to check the output of
`git symbolic-ref HEAD` or equivalent, instead of checking paths?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Multiple checkouts active for the same repository
2010-09-24 13:07 ` Ævar Arnfjörð Bjarmason
@ 2010-09-24 14:42 ` Gustavo Narea
0 siblings, 0 replies; 9+ messages in thread
From: Gustavo Narea @ 2010-09-24 14:42 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: git
Hello,
On 24/09/10 14:07, Ævar Arnfjörð Bjarmason wrote:
> On Fri, Sep 24, 2010 at 09:29, Gustavo Narea
> <gnarea@tech.2degreesnetwork.com> wrote:
>
>> We're currently migrating from another DVCS.
>
> Which one?
Bazaar.
>> We are a team of Web developers and testers working on an application.
>> There are always a few development branches and a stable branch, and
>> testers need all the branches with the very latest code available at all
>> times.
>>
>> The way we handle it at the moment is very simple because the server
>> hosting the remote repository is the same that hosts the deployed
>> instances of each branch, so when we push to the remote repository, the
>> code for each site is automatically updated.
>>
>> We use the following structure:
>> /srv/repositories/project/branch1
>> /srv/repositories/project/branch2
>> /srv/repositories/project/branch3
>>
>> Is there any simple way to do this with Git? I can only think of two
>> options that involve hooks:
>>
>> * Have a hook that exports each branch to a directory like
>> /srv/repositories/project/branchN
>> * Have one Git repository per branch, so that each repository have a
>> different checkout active. Then the main remote repository will
>> have post-receive hooks that trigger a pull on each individual
>>
>> I'm not particularly happy with either way. Is there a better solution?
>
> If you really need this the best solution is to just `git clone` the
> project multiple times and check out each branch in its own dir. Then
> have some shellscript to update them all.
>
> But just using the Git workflow would be better.
OK, I'll do it that way.
>> Apart from the situation I describe in the initial email, there's
>> another limitation in the development environment: Our IDE, Eclipse +
>> Pydev, assumes each project (i.e., branch/checkout) to be on different
>> directories and each project should have different settings (e.g., paths
>> to dependencies, which could be different), but with GIt everything
>> would be a single project because it's all on the same path.
>
> Can't you just modify your build environment to check the output of
> `git symbolic-ref HEAD` or equivalent, instead of checking paths?
Yes, that's what I intend to do for the build system, but that wouldn't
solve the problem with the IDE:
Eclipse and PyDev (Python plugin) store their settings in the project
directory. For example, the one from PyDev contains the absolute paths
to all the dependencies, which makes features like auto-completion work;
I would have to mark these files are ignored because they change from
machine to machine, and sometimes from branch to branch.
So, no matter what the active branch is, I will always get the settings
for the first branch I configured. And if I change them, all the other
branches will be affected.
Any suggestions?
I tried playing with --git-dir and --work-tree, so that I could have the
repository in one place and the checkout for each branch on different
repositories, but it doesn't seem to be a good solution because we
cannot specify the branch in commands like git-status.
Thank you very much.
--
Gustavo Narea.
Software Developer.
2degrees, Ltd. <http://dev.2degreesnetwork.com/>.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Multiple checkouts active for the same repository
2010-09-24 9:29 Multiple checkouts active for the same repository Gustavo Narea
2010-09-24 11:55 ` Gustavo Narea
2010-09-24 13:07 ` Ævar Arnfjörð Bjarmason
@ 2010-09-24 15:33 ` Julian Phillips
2010-09-24 16:32 ` Joshua Jensen
2010-09-27 10:33 ` Gustavo Narea
2010-09-24 15:57 ` Jakub Narebski
3 siblings, 2 replies; 9+ messages in thread
From: Julian Phillips @ 2010-09-24 15:33 UTC (permalink / raw)
To: Gustavo Narea; +Cc: git
On Fri, 24 Sep 2010 10:29:47 +0100, Gustavo Narea
<gnarea@tech.2degreesnetwork.com> wrote:
> Hello.
>
> We're currently migrating from another DVCS, which allows us to have
> working copies of each branch in separate directories, so that their
> code can be used simultaneously. However, I haven't found a way to do
> this with Git, at least not an easy way. Can you please help me?
The git-new-workdir script to be found in contrib/workdir allows multiple
working copies to share the same repository - though there are some
caveats:
1) uses symbolic links, so doesn't work on Windows
2) the working copies are not aware of each other, so if you change a
checked out branch from another working copy you have to remember to git
reset your working copy before doing anything with it to get it back in
sync with the branch
3) you have to remember not to delete the actual clone
4) the working copies are not aware of each other, so it is possible for
objects needed by one working copy to get pruned from another one
Personally, I use this script all the time to checkout multiple branches
at the same time taking care to stay away from the issues above, and
everything hums along nicely.
> We are a team of Web developers and testers working on an application.
> There are always a few development branches and a stable branch, and
> testers need all the branches with the very latest code available at all
> times.
>
> The way we handle it at the moment is very simple because the server
> hosting the remote repository is the same that hosts the deployed
> instances of each branch, so when we push to the remote repository, the
> code for each site is automatically updated.
>
> We use the following structure:
> /srv/repositories/project/branch1
> /srv/repositories/project/branch2
> /srv/repositories/project/branch3
>
> Is there any simple way to do this with Git? I can only think of two
> options that involve hooks:
>
> * Have a hook that exports each branch to a directory like
> /srv/repositories/project/branchN
> * Have one Git repository per branch, so that each repository have a
> different checkout active. Then the main remote repository will
> have post-receive hooks that trigger a pull on each individual
>
> I'm not particularly happy with either way. Is there a better solution?
--
Julian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Multiple checkouts active for the same repository
2010-09-24 15:33 ` Julian Phillips
@ 2010-09-24 16:32 ` Joshua Jensen
2010-09-27 10:33 ` Gustavo Narea
1 sibling, 0 replies; 9+ messages in thread
From: Joshua Jensen @ 2010-09-24 16:32 UTC (permalink / raw)
To: Julian Phillips; +Cc: Gustavo Narea, git
----- Original Message -----
From: Julian Phillips
Date: 9/24/2010 9:33 AM
> The git-new-workdir script to be found in contrib/workdir allows multiple
> working copies to share the same repository - though there are some
> caveats:
>
> 1) uses symbolic links, so doesn't work on Windows
Windows Vista and Windows 7 both support proper file and directory
symbolic links. According to my experimentation the other day with
git-new-workdir on Windows 7:
* Windows - mklink /D creates a directory symbolic link. mklink creates
a file symbolic link. The file system traverses into the symbolic link
and back out of it just like Unix. rmdir /S deletes just the directory
symbolic link. Windows Explorer's delete does the same.
* Cygwin - 'ln -s' does not create a true directory symbolic link.
Cygwin seems to understand the symbolic link, but Windows itself
doesn't. 'rm -f' properly deletes a directory symbolic link.
* Bash included with msysGit - 'ln -s' performs a file/directory copy.
'rm -f' whacks the directory contents of the linked directory and then
deletes the symbolic link. Ick. :(
Josh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Multiple checkouts active for the same repository
2010-09-24 15:33 ` Julian Phillips
2010-09-24 16:32 ` Joshua Jensen
@ 2010-09-27 10:33 ` Gustavo Narea
2010-09-27 11:53 ` Martin Pettersson
1 sibling, 1 reply; 9+ messages in thread
From: Gustavo Narea @ 2010-09-27 10:33 UTC (permalink / raw)
To: Julian Phillips; +Cc: git
Hello,
Thanks! I've given git-new-workdir a try and it seems to be what I was
searching for.
- Gustavo.
On 24/09/10 16:33, Julian Phillips wrote:
> On Fri, 24 Sep 2010 10:29:47 +0100, Gustavo Narea
> <gnarea@tech.2degreesnetwork.com> wrote:
>> Hello.
>>
>> We're currently migrating from another DVCS, which allows us to have
>> working copies of each branch in separate directories, so that their
>> code can be used simultaneously. However, I haven't found a way to do
>> this with Git, at least not an easy way. Can you please help me?
>
> The git-new-workdir script to be found in contrib/workdir allows multiple
> working copies to share the same repository - though there are some
> caveats:
>
> 1) uses symbolic links, so doesn't work on Windows
> 2) the working copies are not aware of each other, so if you change a
> checked out branch from another working copy you have to remember to git
> reset your working copy before doing anything with it to get it back in
> sync with the branch
> 3) you have to remember not to delete the actual clone
> 4) the working copies are not aware of each other, so it is possible for
> objects needed by one working copy to get pruned from another one
>
> Personally, I use this script all the time to checkout multiple branches
> at the same time taking care to stay away from the issues above, and
> everything hums along nicely.
>
>> We are a team of Web developers and testers working on an application.
>> There are always a few development branches and a stable branch, and
>> testers need all the branches with the very latest code available at all
>> times.
>>
>> The way we handle it at the moment is very simple because the server
>> hosting the remote repository is the same that hosts the deployed
>> instances of each branch, so when we push to the remote repository, the
>> code for each site is automatically updated.
>>
>> We use the following structure:
>> /srv/repositories/project/branch1
>> /srv/repositories/project/branch2
>> /srv/repositories/project/branch3
>>
>> Is there any simple way to do this with Git? I can only think of two
>> options that involve hooks:
>>
>> * Have a hook that exports each branch to a directory like
>> /srv/repositories/project/branchN
>> * Have one Git repository per branch, so that each repository have a
>> different checkout active. Then the main remote repository will
>> have post-receive hooks that trigger a pull on each individual
>>
>> I'm not particularly happy with either way. Is there a better solution?
>
--
Gustavo Narea.
Software Developer.
2degrees, Ltd. <http://dev.2degreesnetwork.com/>.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Multiple checkouts active for the same repository
2010-09-27 10:33 ` Gustavo Narea
@ 2010-09-27 11:53 ` Martin Pettersson
0 siblings, 0 replies; 9+ messages in thread
From: Martin Pettersson @ 2010-09-27 11:53 UTC (permalink / raw)
To: git
On Monday, September 27, 2010 05:33:32 pm Gustavo Narea wrote:
> Hello,
>
> Thanks! I've given git-new-workdir a try and it seems to be what I was
> searching for.
>
> - Gustavo.
>
> On 24/09/10 16:33, Julian Phillips wrote:
> > On Fri, 24 Sep 2010 10:29:47 +0100, Gustavo Narea
> >
> > <gnarea@tech.2degreesnetwork.com> wrote:
> >> Hello.
> >>
> >> We're currently migrating from another DVCS, which allows us to have
> >> working copies of each branch in separate directories, so that their
> >> code can be used simultaneously. However, I haven't found a way to do
> >> this with Git, at least not an easy way. Can you please help me?
> >
> > The git-new-workdir script to be found in contrib/workdir allows multiple
> > working copies to share the same repository - though there are some
> >
> > caveats:
> > 1) uses symbolic links, so doesn't work on Windows
> > 2) the working copies are not aware of each other, so if you change a
> >
> > checked out branch from another working copy you have to remember to git
> > reset your working copy before doing anything with it to get it back in
> > sync with the branch
> >
> > 3) you have to remember not to delete the actual clone
> > 4) the working copies are not aware of each other, so it is possible for
> >
> > objects needed by one working copy to get pruned from another one
> >
> > Personally, I use this script all the time to checkout multiple branches
> > at the same time taking care to stay away from the issues above, and
> > everything hums along nicely.
> >
> >> We are a team of Web developers and testers working on an application.
> >> There are always a few development branches and a stable branch, and
> >> testers need all the branches with the very latest code available at all
> >> times.
> >>
> >> The way we handle it at the moment is very simple because the server
> >> hosting the remote repository is the same that hosts the deployed
> >> instances of each branch, so when we push to the remote repository, the
> >> code for each site is automatically updated.
> >>
> >> We use the following structure:
> >> /srv/repositories/project/branch1
> >> /srv/repositories/project/branch2
> >> /srv/repositories/project/branch3
> >>
> >> Is there any simple way to do this with Git? I can only think of two
> >>
> >> options that involve hooks:
> >> * Have a hook that exports each branch to a directory like
> >>
> >> /srv/repositories/project/branchN
> >>
> >> * Have one Git repository per branch, so that each repository have a
> >>
> >> different checkout active. Then the main remote repository will
> >> have post-receive hooks that trigger a pull on each individual
> >>
> >> I'm not particularly happy with either way. Is there a better solution?
just check out the branch you need... If you are absolutely in big need of
reaching multiple branches at the same time just make a couple of clones...
Martin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Multiple checkouts active for the same repository
2010-09-24 9:29 Multiple checkouts active for the same repository Gustavo Narea
` (2 preceding siblings ...)
2010-09-24 15:33 ` Julian Phillips
@ 2010-09-24 15:57 ` Jakub Narebski
3 siblings, 0 replies; 9+ messages in thread
From: Jakub Narebski @ 2010-09-24 15:57 UTC (permalink / raw)
To: Gustavo Narea; +Cc: git
Gustavo Narea <gnarea@tech.2degreesnetwork.com> writes:
> Hello.
>
> We're currently migrating from another DVCS, which allows us to have
> working copies of each branch in separate directories, so that their
> code can be used simultaneously. However, I haven't found a way to do
> this with Git, at least not an easy way. Can you please help me?
Use git-new-workdir script from contrib/workdir/ in git repository
http://repo.or.cz/w/git.git/blob/HEAD:/contrib/workdir/git-new-workdir
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 9+ messages in thread