osx - Implement .gitignore behavior in a shell script? -
i'm writing shell script syncs files , want give users ability exclude files syncing creating .syncignore file similar git's .gitignore file. according gitignore documentation, , own experiments, these exclusion rules more complicated simple glob match. examples:
- if have
fooin.gitignorefile, excludefooappearing anywhere in path (e.g../foo,./bar/foo, ,./bar/foo/bazexcluded) not partial matches offoo(e.g../foobar,./bar/foobar/baznot excluded). - if include slash, rule applied relative current directory. example, if have
/fooin.gitignorefile, exclude./foonot./bar/foo. - you can include wildcards. example,
foo*exclude./foo,./foobar, ,./bar/foobar/baz.
is there easy way replicate exclusion rules .gitignore in shell script on os x?
use
rsyncsynchronize files. use existing include/exclude pattern support. put rules in.rsync-filter, pass-fflag make read patterns file.just use
git. make sure have git 2.3.0 or later on both sides, , use push-to-deploy.
Comments
Post a Comment