[英]rsync betwen repositories the files that git does not track
Say I have a git directory in path_A
in a machine A
with .gitignore
files all over the place. 假设我在机器
A
path_A
中有一个git目录, path_A
都有.gitignore
文件。 I have a copy of this repository in a machine in path_B
in a different machine B
. 我在另一台机器
B
path_B
中的机器中有此存储库的副本。
I would like to rsync
all files from path_A
to path_B
that are not tracked by git so that both machines have effectively the same files (eg including binaries). 我想
rsync
所有文件path_A
到path_B
不是由git的跟踪,使两台机器实际上是相同的文件(例如,包括二进制文件)。 Is there a relatively simple way of doing this? 有相对简单的方法吗?
You can give 2 arguments to rsync - first exclude all files: --exclude="*"
then use include-from with the .gitignore file as argument: --include-from='.gitignore'
您可以给rsync提供2个参数-首先排除所有文件:--exclude
--exclude="*"
然后将include-from与.gitignore文件一起用作参数: --include-from='.gitignore'
The first exclusion makes rsync ignore all by default. 默认情况下,第一个排除项使rsync忽略全部。 The latter inclusion reads include patterns from a file called .gitignore, which leads to all gitignored files being included in the rsync.
后面的包含读取包含来自名为.gitignore的文件的模式,这会导致所有gitignored文件都包含在rsync中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.