SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from RedHat EL 7 git-tools-2019.11-1.el7.noarch.rpm

GIT-CLONE-SUBSET

Section: User Commands (1)
Updated: 2016-01-31
Index 

NAME

git-clone-subset -Clones a subset of a git repository 

SYNOPSIS

git-clone-subset[options]repository destination-dir pattern 

DESCRIPTION

Clones arepositoryinto adestination-dirand runs on the clone
git filter-branch --prune-empty --tree-filter 'git rm ...' -- --all
to prune from history all files except the ones matchingpattern,effectively creating a clone with a subset of files (and history) of theoriginal repository.

Useful for creating a new repository out of a set of files from anotherrepository, migrating (only) their associated history. Very similar towhat
git filter-branch --subdirectory-filter
does, but for a filepattern instead of just a single directory. 

OPTIONS

-h, --help
show usage information.
repository
URL or local path to the git repository to be cloned.
destination-dir
Directory to create the clone. Same rules for git-clone applies: itwill be created if it does not exist and it must be empty otherwise.But, unlike git-clone, this argument is not optional: git-clone usesseveral rules to determine the "Humane" dir name of a cloned repo,and git-clone-subset will not risk parse its output, let alonepredict the chosen name.
pattern
Glob pattern to match the desired files/dirs. It will be ultimatelyevaluated by a call to bash, NOT git or sh, using extendedglob '!(<pattern>)' rule. Quote it or escape it on command line, so itdoes not get evaluated prematurely by your current shell. Only asingle pattern is allowed: if more are required, use extglob's "|"syntax. Globs will be evaluated with bash's shopt dotglob set, sobeware. Patterns should not contain spaces or special charslike " ' $ ( ) { } `, not even quoted or escaped, since that mightinterphere with the !() syntax after pattern expansion.

Pattern Examples:

"*.png"
"*.png|*icon*"
"*.h|src/|lib"

 

LIMITATIONS

Renames are NOT followed. As a workaround, list the rename historywith 'git log --follow --name-status --format='%H' -- file | grep "^[RAD]"'and include all multiple names of a file in the pattern, asin "currentname|oldname|initialname". As a side efect, if a differentfile has taken place of an old name, it will be preserved too, andthere is no way around this using this tool.

There is no (easy) way to keep some files in a dir: using 'dir/foo*'as pattern will not work. So keep the whole dir and remove filesafterwards, using git filter-branch and a (quite complex) combinationof cloning, remote add, rebases, etc.

Pattern matching is quite limited, and many of bash's escaping andquoting does not work properly when pattern is expanded inside !(). 

SEE ALSO

https://github.com/MestreLion/git-tools 

AUTHOR

Rodrigo Silva (MestreLion) linuxAATTrodrigosilva.com


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
LIMITATIONS
SEE ALSO
AUTHOR

This document was created byman2html,using the manual pages.