git-export-path
can be used to export files and/or directories from one Git
repository into a new or existing Git repository (under any sub-directory).
- Operating system: Linux
- Bash: a reasonably newer version
- Git: a reasonably newer version
git-export-path
has fairly informative help, just typing:
git-export-path -h
The command syntax is:
git-export-path [-h|--help]
git-export-path [OPTIONS] SOURCE-URL DEST-REPO-DIR PATH...
This will export PATH...
from git repository SOURCE-URL
, into git repository
at DEST-REPO-DIR
. If DEST-REPO-DIR
is an existing local git repository,
PATH...
will be exported into the the existing repository, in
DEST-REPO-DIR/DEST-DIR
directory; otherwise, a new git repository at
DEST-REPO-DIR
will be generated, with PATH...
imported in
DEST-REPO-DIR/DEST-DIR
.
Optional arguments:
-h
Display this help and exit-b|--branch
The source repository branch, default tomaster
-d|--dest-dir DEST-DIR
MovePATH...
intoDEST-REPO-DIR/DEST-DIR
. If this option is absent, don’t move, i.e., keep the original sub directories; the value.
means movingPATH...
to root inDEST-REPO-DIR
.-m|--merge-subtree
Don’t rebase, but merge the sub tree into repositoryDEST-REPO-DIR
(I personally prefer rebase). This option applies only when exporting to an existing repository.
Positional arguments:
SOURCE-URL
The source git repository to extractPATH...
fromDEST-REPO-DIR
The local directory of destination git repository to exportPATH...
intoPATH...
The paths to export.PATH
… are relative to the source repository root directory.