Separate git directories (master/dev) -
i work locally in 1 directory source code. i've got 2 branches : master , dev. want push on dedicated server each branch own directory, resulting 1 directory production , developpement. next, can configure nginx accessing each 1 on subdomains, etc.
i tried use code, on post-receive file in (only) project.git/hooks/post-receive.
#!/bin/bash while read oldrev newrev ref branch=`echo $ref | cut -d/ -f3` if [ "master" == "$branch" ]; git --work-tree=/home/myself/project/site --git-dir=/home/myself/myproject/myproject.git checkout -f echo 'changes pushed live.' fi if [ "dev" == "$branch" ]; git --work-tree=/home/myself/myproject/site-dev --git-dir=/home/myself/myproject/myproject.git checkout -f echo 'changes pushed dev.' fi done
i try commit changes dev branch. push ("changes pushed dev"). dev directory has not been changed @ on remote server (same master branch).
could me please ?
thanks !
as mentioned in comments. git not deploy tool. should have git-post-recv trigger deploy-tool actual deploy.
however, deploy-script similar hook have above, , exhibit same issue. part appears missing choose dev
branch checked out in site-dev
directory. command
git --work-tree=/home/myself/myproject/site-dev --git-dir=/home/myself/myproject/myproject.git checkout -f
will check out current head (typically master) there. try adding dev
checkout command.
you may interested add variation of git clean -ffdx
remove files not known git, have pristine checkout.
Comments
Post a Comment