So I'm trying to work on a command to rsync a source folder with a structure like so:
- app.js - .gitignore - src/ - src/logs/ - src/logs/.gitignore
The first .gitignore would have a series of files ignored. Typical stuff. The second would look like the following:
This technique is used when you want to check in a directory with none of the files inside. There may also be more .gitignores throughout the directory - this is only one scenario. So my question is this: Is it possible to make rsync interpret all .gitignores relative to the directory they are in?
My initial attempt was the following:
- Glob all .gitignores in the directory.
- Build command that looks something like:
rsync --exclude-from=.gitignore --exclude-from=src/logs/.gitignore --exclude-from=some/other/folder/.gitignore [source] [destination]
However, this did not work as expected for me. Everything is being ignored because it is reading all of the .gitignore files as if they are at the root. Is there any possible way to do this without having to grep for all .gitignores and create one master file with re-written paths all relative to the root directory?