What's the best way to checkout selected files and folders from a bare git repository on linux? -
What's the best way to checkout selected files and folders from a bare git repository on linux? -
i'm setting git repository website on godaddy shared hosting account. 1 set git bare repo on server contained live web info only, on push remote utilize git post-receive hook checkout live directory (thanks @vonc links).
that's fine, i've set repository include work files well. on server have,
/home/username/repo.git/work_folders, , /home/username/repo/web_files_and_folders
for repository, and,
/home/username/public_html/web_files_and_folders
for live files , folders.
the work_folders contain svg, png , jpg files used generate png , jpg files website. these master files part of development of website.
the thing can't find easy way git checkout web_files_and_folders live given branch. utilize shell wildcard select web_files_and_folders doesn't solve knowing branch name (which alter of course of study each branch).
do need merge master (for instance) , shell wildcard in post-receive hook? if so, may problem other less tech savy people i'm trying utilize repo.
edit -------------------
so, update. terminal shell entered,
git_work_tree=/home/user/public_html/dev git checkout -f dev devpath/web/*
which extracted right files web folder rather getting,
/home/user/public_html/dev/*
i got,
/home/user/public_html/dev/devpath/web/*
evidently i'm missing how alter extract path.
edit 2 -------------------
ok, more detail...
i have bare repo setup on shared server at,
/home/user/repo.git
the local repository has 2 branches, dev , master, file format like,
/devpath/logos/ /devpath/photos/ ... /devpath/web/ (website root files , folders)
the thought develop in dev branch, force server , test on dev.url of website, , when things merge dev branch master, force server , go live. 2 of developing website.
the post-receive hook isn't completed yet similar this one. utilize pretty much same link except want remote repository store other development files. these files part of website development , need shared.
what saw in first edit effort checkout dev branch dev test site. on server test site subdomain , accessed folder under public html root in filesystem.
it looks me checking out wildcard selector,
git_work_tree=/home/user/public_html/dev git checkout -f dev devpath/web/*
also puts files under same path prior wildcard. need able define new default path.
i have git 1.7.1 on server.
that doesn't solve knowing branch name
regarding that, post-update hook can observe branch beingness pushed. see:
"separate git deployments on single server" "how process files on branch in post-receive hook in git"something like:
class="lang-bash prettyprint-override">#!/bin/bash while read oldrev newrev ref branch=`echo $ref | cutting -d/ -f3` if [ "master" == "$branch" ]; ....
git repository push wildcard
Comments
Post a Comment