Skip to contentSkip to conversation

Problem with architecture git.

DISCUSSION Alexander 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

Alexander

author
#0 lore raw

Hello,

I have problem with architecure of my project, help me to resolve problem . I want to do in my remote repo two branches with two different working folders (master , dev ) to check it . How can I do it ?

Thank you.

#1 lore raw
Quoted 8 lines · Alexander

Hello,

I have problem with architecure of my project, help me to resolve problem
. I want to do in my remote repo two branches with two different working
folders (master , dev ) to check it . How can I do it ? Thank you.

Sounds like you want the git worktree functionality currently being baked.

git clone <remote>
cd <repo>
git checkout master
git worktree add <path/to/dev> dev

This allows you to have both master checked out at the location path/to/dev and the master checked out where repo is stored. Quite valuable

I think this solves what you're looking for? I don't know what version git-worktree is supported by..

Regards,
Jake

#2 lore raw
In reply to Alexander
Quoted 7 lines · Alexander

Hello,

I have problem with architecure of my project, help me to resolve problem . I want to do in my remote repo two branches with two different working folders (master , dev ) to check it . How can I do it ?

Thank you.

You'll probably want something like this in your remote (presumably bare) repo's post receive hook:

#!/bin/sh

GIT_WORK_TREE=/var/www/html/www.foo.com git checkout master -f GIT_WORK_TREE=/var/www/html/www.foo.com git clean -f GIT_WORK_TREE=/var/www/html/dev.foo.com git checkout dev -f GIT_WORK_TREE=/var/www/html/dev.foo.com git clean -f

It's one-way, from Git to the directories only, but should do the trick.

Hope that helps,
Zoë.