rsync를 사용하여 git 하위 디렉터리 없이 디렉터리를 백업하는 방법

rsync를 사용하여 git 하위 디렉터리 없이 디렉터리를 백업하는 방법

c내 디렉터리와 하위 디렉터리를 제외한 모든 하위 디렉터리를 복사하고 싶습니다 ./git. 나는 사용한다 rsync:

echo "copy c and sh files "
rsync -a --include='*.c' --include='*.sh' --include='*/' --exclude='*' ~/c/ ~/Dropbox/Public/c
# remove .git directory = do not send it to dropbox. Thx to Tomasz Sowa
rm -rf ~/Dropbox/Public/c/.git

내가 더 잘할 수 있을까?

답변1

.git에 대한 명시적 제외를 추가하면 됩니다.

rsync -a --exclude='.git/' --include='*.c' --include='*.sh' --include='*/' --exclude='*' ~/c/ ~/Dropbox/Public/c

~/.cvsignore또 다른 옵션은 다음 줄과 제외하려는 다른 디렉터리를 포함하는 디렉터리를 만드는 것입니다 .

.git/

답변2

을 사용할 수도 있습니다 rsync --cvs-exclude. 또한 .git디렉토리를 무시합니다.

그러나 이는 coreMagento 소스 파일에 나타나는 디렉터리도 무시한다는 점에 유의하세요.

관련 정보