user1233963
user1233963

Reputation: 1490

rsyncing git project folder

I need to rsync a git project folder and I'm using the follow rsync flags -r -a -v -u -W but when I run git status on the destination folder it does not match with git status on the source (I get modified/deleted files that were not actually touched).

Why is this happening? And how to make it work as intended?

Upvotes: 2

Views: 2444

Answers (2)

Lawrence D'Oliveiro
Lawrence D'Oliveiro

Reputation: 2804

The usual rsync command I use is

rsync --archive --delete --verbose src-dir/ dst-dir/

This makes dst-dir an exact mirror of src-dir. This will pick up everything, including your .git subdir and untracked files.

Upvotes: 3

pacholik
pacholik

Reputation: 8992

From rsync manual:

-u, --update                skip files that are newer on the receiver

So it may skip files...

Use git

Anyway, there is no need for rsync when you have the source dir versioned.

Clone the folder

cd /my/destination
git clone /my/source/repo

Sync the folder

cd /my/destination/repo
git fetch

Upvotes: 2

Related Questions