Re: can I use multiple worktree in same git repo ?
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Jul 20, 2011, 13:25 UTC
- Message-ID
- <CACsJy8CLRjLag65H6KQ1AUABLwiL09wNQw3VH8Y-JQnw7CqLUw@mail.gmail.com>
- In-Reply-To
- <20110720182438.3c40cf1d@shiva.selfip.org>
On Wed, Jul 20, 2011 at 7:54 PM, J. Bakshi <joydeep@infoservices.in> wrote:
> As a result whenever there is a commit , it updates the related folder in filesystem. > Say a commit at svn->mysite-repo->dir1->trunk->src ==> modify ==> /var/www/demo/dir1 > > Can I do the same in git with multiple worktree ? possible ?
Using multiple worktree with the same repo won't work in git because the repo also have worktree-related information. But you can create a central, bare repository, then make several clones from that. Each one is checked out with different branches. You work on a clone and push to the central repo. The post-commit hook in the central repo will do pull from it, for example
for site in dir1 dir2 dir3; do
cd /var/www/$site && /usr/bin/git pull
doneAlso have a look at git-new-workdir in contrib directory of git repository. I don't use it but you might find it useful.
-- Duy