git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: can I use multiple worktree in same git repo ?

From
JBJ. Bakshi <joydeep@infoservices.in>
Date
Jul 21, 2011, 06:07 UTC
Message-ID
<20110721113702.329f73b5@shiva.selfip.org>
In-Reply-To
<CACsJy8DswCJS8YfaG=e73g1ZDVRV1H3Z0St7zaAEuuwYxgxgBQ@mail.gmail.com>

On Thu, 21 Jul 2011 10:20:13 +0700 Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:

Show 35 quoted lines
> On Wed, Jul 20, 2011 at 11:12 PM, J. Bakshi <j.bakshi@unlimitedmail.org> wrote:
> > Thanks for your response. I am afraid that I can't understand the approach clearly but I must say that I am hopeful to see a direction.
> > Obviously there will be a central git repo which will have its worktree under htdocs at the same server.
> 
> No, the central repository does not need worktree attached (in other
> words "bare repository"). You modify in a clone from it and push
> to/pull from it.
> 
> > That's why the post-receive
> > hook will update the website after each push. But the issue is mapping the structure at git which is different than the structure at
> > filesystem. And a push should reflect to its correct folder only.
> >
> > [git]->[mysite]->dir1/trunk/src => physically map => htdocs/demo/dir1
> > [git]->[mysite]->dir2/trunk/src => physically map => htdocs/demo/dir2
> >
> >
> > Please tell me with little more clarification, how can I do this ?
> 
> OK, let's create a central repository
> 
> GIT_DIR=/somewhere/safe/repo.git git init --bare
> 
> Then clone it where development happens
> 
> git clone /somewhere/safe/repo.git ~/dev
> cd ~/dev
> 
> Now we create "dir1" and "dir2" branches, correponding to what you
> have in the original tree
> 
> git checkout -b dir1
> # put contents of dir1/trunk/src here, commit
> git checkout -b dir2 master
> # put contents of dir2/trunk/src here, commit
> 

Just here, just here... The git should have dir1/trunk/src which should update /var/www/demo/dir1 and dir2/trunk/src which should update /var/www/demo/dir2

Thanks for your detailed clarification, very nice....
Previous: Nguyen Thai Ngoc DuyNext: Jakub Narebski
Message 5 of 9 in “can I use multiple worktree in same git repo ?”
  1. J. BakshiJul 20, 2011
  2. Nguyen Thai Ngoc DuyJul 20, 2011
  3. J. BakshiJul 20, 2011
  4. Nguyen Thai Ngoc DuyJul 21, 2011
  5. J. BakshiJul 21, 2011
  6. Jakub NarebskiJul 21, 2011
  7. Fredrik GustafssonJul 21, 2011
  8. Jakub NarebskiJul 21, 2011
  9. SergioJul 22, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.