Skip to content

Instantly share code, notes, and snippets.

@4piu
Last active November 10, 2021 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4piu/dd11420841564a435b8d1b35de3a6fd1 to your computer and use it in GitHub Desktop.
Save 4piu/dd11420841564a435b8d1b35de3a6fd1 to your computer and use it in GitHub Desktop.
Sync large project using rsync with respect to gitignore
#!/usr/bin/env bash
# https://stackoverflow.com/questions/13713101/rsync-exclude-according-to-gitignore-hgignore-svnignore-like-filter-c
SOURCE="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
TARGET=user@remote:/path/to/my/blog
rsync --delete-after --filter=":e- .gitignore" --filter "- .git/" -a --progress $SOURCE/ $TARGET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment