将.gitignore转换为rsync合并过滤器包含文件?(使用sed或awk)

sab*_*ton 5 git awk rsync sed

我尝试使用rsync --filter=':+ .gitignore' (-/ exclude作品,但不包括)无济于事。

基本上,我只想在脚本中包含.ignore文件,并使用rsync将其中的所有内容上传到远程服务器。

如果有人能够将sed或awk .gitignore放入适合包含在--filter='merge file' etc中的文件中,我将不胜感激!

或者替代地,一种使rsync理解.gitignore包含的方式。

https://www.kernel.org/pub/software/scm/git/docs/gitignore.html '样式格式'

http://linux.die.net/man/3/fnmatch

https://git.samba.org/?p=rsync.git;a=blob_plain;f=wildtest.txt;hb=HEAD

https://git.samba.org/?p=rsync.git;a=blob_plain;f=wildtest.c;hb=HEAD

rsync中的某些问题bla/仅表示该目录,bla/*表示该目录中的文件,表示该目录bla/**下的bla/***所有内容(包括子目录),最后表示bla及其所有内容,但git可能具有的所有内容bla/

但是排除规则似乎是兼容的。

Ara*_*ion 2

也许是这样的:(再次,未经测试)

git ls-files -oz | rsync --include-from=- --from0
Run Code Online (Sandbox Code Playgroud)