rsync exclude according to .gitignore & .hgignore & svn:ignore like --filter=:C

后端 未结 13 2819
没有蜡笔的小新
没有蜡笔的小新 2020-12-22 17:22

Rsync includes a nifty option --cvs-exclude to “ignore files in the same way CVS does”, but CVS has been obsolete for years. Is there any way to make it also ex

13条回答
  •  佛祖请我去吃肉
    2020-12-22 17:46

    You can use git ls-files to build the list of files excluded by the repository's .gitignore files. https://git-scm.com/docs/git-ls-files

    Options:

    • --exclude-standard Consider all .gitignore files.
    • -o Don't ignore unstaged changes.
    • -i Only output ignored files.
    • --directory Only output the directory path if the entire directory is ignored.

    The only thing I left to ignore was .git.

    rsync -azP --exclude=.git --exclude=`git -C  ls-files --exclude-standard -oi --directory`  
    

提交回复
热议问题