Skip to content

Instantly share code, notes, and snippets.

@YasienDwieb
Last active March 27, 2022 12:32
Show Gist options
  • Save YasienDwieb/2fc1d43b1c02b73e0d305c6f2deda053 to your computer and use it in GitHub Desktop.
Save YasienDwieb/2fc1d43b1c02b73e0d305c6f2deda053 to your computer and use it in GitHub Desktop.
Sync files with remote server while excluding .git folder
#!/bin/bash
if [ $# -lt 2 ]
then
echo "Usage: $0 <src> <dst> [any-rsync-option]"
exit
fi
rsync -aruvzp --progress --exclude='.git/' $@
@Diablo2050
Copy link

Add support for custom SSH port.

@YasienDwieb
Copy link
Author

Okay thanks I will do that @Diablo2050

@YasienDwieb
Copy link
Author

would you check it now @Diablo2050

@mohamed-foly
Copy link

any support for excluding many files and folders ?

@YasienDwieb
Copy link
Author

@mohamed-foly as mentioned on rsync docs, you can use multiple --exclude options. So by default this script will ignore '.git', but you can add extra --exclude options to ignore further folders/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment