folders - Git clone only a subdirectory, at the root of the current directory -
i have few folders on git repo:
folder1/suba folder2/subb folder3/subc and locally have public folder on web server.
http://domain.com/ points folder
~/apps/appname/public i git clone of folder3/subc public folder on server. know sparse checkout, retains folder hierarchy (like ~/apps/appname/public/folder3/subc).
i not want hierarchy , checkout content of folder3/subc directly public folder.
is possible?
if ~/apps/appname/public on shared filesystem, , webserver doesn't alter checked-out files, can maintain dedicated index of contents , use git read-tree -um update filesystem commit like:
( export git_index_file=/path/to/repo/.git/appname-public-manifest export git_work_tree=~/apps/appname/public git read-tree -um `git write-tree` master:folder3/subc ) the git write-tree writes tree git read-tree inspect, , read-tree applies differences between what's there , what's in specified tree index , worktree.
if there's nothing in directory there's no need initialize, otherwise
( export git_index_file=/path/to/repo/.git/appname-public-manifest export git_work_tree=~/apps/appname/public git read-tree --empty # start nothing git add . # index what's there ) will set manifest match what's there.
Comments
Post a Comment