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:

  1. if have foo in .gitignore file, exclude foo appearing anywhere in path (e.g. ./foo, ./bar/foo, , ./bar/foo/baz excluded) not partial matches of foo (e.g. ./foobar, ./bar/foobar/baz not excluded).
  2. if include slash, rule applied relative current directory. example, if have /foo in .gitignore file, exclude ./foo not ./bar/foo.
  3. 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?

  1. use rsync synchronize files. use existing include/exclude pattern support. put rules in .rsync-filter , pass -f flag make read patterns file.

    rsync man page

  2. just use git. make sure have git 2.3.0 or later on both sides, , use push-to-deploy.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -