git - how to auto export files when merge a branch? -


i'm working website using git repository 2 branches master-branch , dev-branch.

i work in dev-branch , when things go fine merge master-branch. , need copy whole dir deployment directory or upload server.

i know if there way automatically export/copy files/changes directory every time merged/commit master-branch?


i know there kind of nodejs plugin watches directory , auto upload files deployment server when files inside changed. didn't try them.

i appreciate if have better way upload them without running nodejs app, or using git itself.

thanks.

you set post-merge hook task you. however, hook run when git merge might not best solution general use.

i set small script me.

first, have build list of files modified. can done git diff:

git diff --name-only $fromrev..$torev > filelist 

where

  • $fromrev old revision (i.e. last revision created archive)
  • $torev new revision (i.e. current state want export)
  • filelist temporary file hold file names zip later

this list of files use git archive create archive modified files:

git archive --format zip --output /full/path/to/archive.zip $torev $(cat filelist) 

this instructs git create zip archive called archive.zip @ directory /full/path/to/. revision zipped $torev. in addition, not files zipped contained in filelist.

or, one-liner:

git archive --format zip --output /full/path/to/archive.zip $torev $(git diff --name-only $fromrev..$torev) 

you manually call script whenever think shall exported , feed in fromrev, torev , /full/path/to/archive.zip


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -