Nest only a part of upstream
Sometimes you need only some files of upstream. git-nested has three ways to pick them. You choose them at clone time.
Option |
Use it to |
|---|---|
|
leave a few paths out, for example test data |
|
keep only a few paths |
|
take one folder of upstream as the whole nested folder |
Each choice is stored in .gitnested. pull and push follow it.
Leave paths out: --exclude
git nested clone --exclude tests --exclude docs/big.pdf https://github.com/user/lib ext/lib
Each
--excludeis a file or a folder of upstream.pullkeeps them out.pushnever deletes them upstream.
Keep only some paths: --filter
git nested clone --filter src --filter LICENSE https://github.com/user/lib ext/lib
Each --filter is one of:
a file of upstream,
a folder of upstream, with everything in it,
a regular expression. It must match the whole path, for example
docs/.*\.md.
A push gives back the files you left out, as they are upstream. So they are not deleted there.
You can use --filter and --exclude together. Then git-nested keeps what
the filter selects, minus the excluded paths.
One folder: --path
Upstream has javascript/, and you want only that, as ext/js/:
git nested clone --path javascript https://github.com/user/lib ext/js
ext/js/holds what upstream has injavascript/.pulltakes only that folder.pushputs your changes back underjavascript/.
--path can not be used with --filter.
Limits
pull --no-squashandsquash: falsedo not work with any of these. The upstream commits would bring back the files you left out.filter,excludeandpathcan not be changed withgit nested config. To change them, clone again:
git nested clone --force --exclude tests https://github.com/user/lib ext/lib