linux - Git push to master repo then send the dist folder to a specific path(/www/site/v0.0.1)? -
so goal push project core repo, development files live, backup purposes.
then want send dist
folder directory www/site.com/v0.0.1
, demonstration purposes, no development files needed, cause bloat because have multiple directories.
so have right .gitignore
ignores pretty dist
.
i ran git rm -r --cache
, pushing dist
, pitfall cant core repo, in case local environment destroyed, have compiled code, , not reverse engineering that.
#!/bin/sh currentversion=git describe --abbrev=0 mkdir /var/www/example.com/public_html/projects/$currentversion git --work-tree=/var/www/example.com/public_html/projects/$currentversion --git-dir=/var/repo/cool.git checkout -f
i can think of 2 situations
two remote repos (core.git, demos.git),
git add remote <ssh-repo/core.git & demos.git>
, pitfall.gitignore
how supposed specify repo uses ignores? 2 repos kind of sucks.inside bash script write enables me ignore files, add worktree, or possibly use linux command take dist , put desired version
post-receive
event?
a third possibly use branches, still git novice , not sure can do.
edit: 2 repos stupid if pushing dist folder, think in bash script need somehow take dist folder , use command copy desired path.
if dist dir contains generated artifacts , can re-created rest of core files i'd suggest 2 repos:
- dist generated artifacts
- core rest plus symlink dist repo (added git or not, each has advantages , disadvantages, you)
something along line (they don't have side side, whatever's convenient you):
$~/git> ls -la * core: total 36 drwxrwxr-x 3 user @ 4096 apr 22 22:22 . drwxrwxr-x 4 user @ 4096 apr 22 22:22 .. -rw-rw-r-- 1 user @ 22811 apr 22 22:22 blah lrwxrwxrwx 1 user @ 7 apr 22 22:22 dist -> ../dist drwxrwxr-x 8 user @ 4096 apr 22 22:23 .git dist: total 16 drwxrwxr-x 3 user @ 4096 apr 22 22:23 . drwxrwxr-x 4 user @ 4096 apr 22 22:22 .. -rw-rw-r-- 1 user @ 84 apr 22 22:24 blah_dist drwxrwxr-x 8 user @ 4096 apr 22 22:24 .git
no need .gitignore files. pushes core dir go source code backup repo, pushes dist dir (even under symlink inside core) go deployment repo(s). git smart enough to not mix 2 repos:
$~/git/core> git status on branch master nothing commit, working directory clean $~/git/core> cd dist/ $~/git/core/dist> git status on branch master changes not staged commit: (use "git add <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) modified: blah_dist no changes added commit (use "git add" and/or "git commit -a") $~/git/core/dist>
even if have files should shared both repos can consider them 'generated': have them in core repo , 'generate' them plain copy dist symlink/repo needed.
you can automate generation/refresh of dist artifacts using git push hook in core repo.
Comments
Post a Comment