github.com/stffabi/git-lfs@v2.3.5-0.20180214015214-8eeaa8d88902+incompatible/docs/man/git-lfs-migrate.1.ronn (about) 1 git-lfs-migrate(1) - Migrate history to or from git-lfs 2 ======================================================= 3 4 ## SYNOPSIS 5 6 `git lfs migrate` <mode> [options] [--] [branch ...] 7 8 ## MODES 9 10 * `info` 11 Show information about repository size. 12 13 * `import` 14 Convert large Git objects to LFS pointers. 15 16 ## OPTIONS 17 18 * `-I` <paths> `--include=`<paths>: 19 See [INCLUDE AND EXCLUDE]. 20 21 * `-X` <paths> `--exclude=`<paths>: 22 See [INCLUDE AND EXCLUDE]. 23 24 * `--include-ref`=<refname>: 25 See [INCLUDE AND EXCLUDE (REFS)]. 26 27 * `--exclude-ref`=<refname>: 28 See [INCLUDE AND EXCLUDE (REFS)]. 29 30 * `--skip-fetch`: 31 Assumes that the known set of remote references is complete, and should not 32 be refreshed when determining the set of "un-pushed" commits to migrate. Has 33 no effect when combined with `--include-ref` or `--exclude-ref`. 34 35 * `--everything`: 36 See [INCLUDE AND EXCLUDE (REFS)]. 37 38 * [branch ...]: 39 Migrate only the set of branches listed. If not given, `git-lfs-migrate(1)` 40 will migrate the currently checked out branch. 41 42 References beginning with '^' will be excluded, whereas branches that do not 43 begin with '^' will be included. 44 45 If any of `--include-ref` or `--exclude-ref` are given, the checked out 46 branch will not be appended, but branches given explicitly will be appended. 47 48 ### INFO 49 50 The 'info' mode has these additional options: 51 52 * `--above=<size>` 53 Only count files whose individual filesize is above the given size. 'size' 54 may be specified as a number of bytes, or a number followed by a storage 55 unit, e.g., "1b", "20 MB", "3 TiB", etc. 56 57 If a set of files sharing a common extension has no files in that set whose 58 individual size is above the given `--above` no files no entry for that set 59 will be shown. 60 61 * `--top=<n>` 62 Only include the top 'n' entries, ordered by how many total files match the 63 given pathspec. 64 65 * `--unit=<unit>` 66 Format the number of bytes in each entry as a quantity of the storage unit 67 provided. Valid units include: 68 * b, kib, mib, gib, tib, pib - for IEC storage units 69 * b, kb, mb, gb, tb, pb - for SI storage units 70 71 If a --unit is not specified, the largest unit that can fit the number of 72 counted bytes as a whole number quantity is chosen. 73 74 ### IMPORT 75 76 The 'import' mode migrates large objects present in the Git history to pointer 77 files tracked and stored with Git LFS. It supports all the core 'migrate' 78 options and these additional ones: 79 80 * `--verbose` 81 Print the commit oid and filename of migrated files to STDOUT. 82 83 If `--include` or `--exclude` (`-I`, `-X`, respectively) are given, the 84 .gitattributes will be modified to include any new filepath patterns as given by 85 those flags. 86 87 If neither of those flags are given, the gitattributes will be incrementally 88 modified to include new filepath extensions as they are rewritten in history. 89 90 ## INCLUDE AND EXCLUDE 91 92 You can configure Git LFS to only migrate tree entries whose pathspec matches 93 the include glob and does not match the exclude glob, to reduce total migration 94 time or to only migrate part of your repo. Specify multiple patterns using the 95 comma as the delimiter. 96 97 Pattern matching is done as given to be functionally equivalent to pattern 98 matching as in .gitattributes. 99 100 ## INCLUDE AND EXCLUDE (REFS) 101 102 You can configure Git LFS to only migrate commits reachable by references 103 include by `--include-ref` and not reachable by `--exclude-ref`. 104 105 D---E---F 106 / \ 107 A---B------C refs/heads/my-feature 108 \ \ 109 \ refs/heads/master 110 \ 111 refs/remotes/origin/master 112 113 In the above configuration, the following commits are reachable by each ref: 114 115 refs/heads/master: C, B, A 116 refs/heads/my-feature: F, E, D, B, A 117 refs/remote/origin/master: A 118 119 The following configuration: 120 121 --include-ref=refs/heads/my-feature 122 --include-ref=refs/heads/master 123 --exclude-ref=refs/remotes/origin/master 124 125 Would, therefore, include commits: F, E, D, C, B, but exclude commit A. 126 127 The presence of flag `--everything` indicates that all local references should be 128 migrated. 129 130 ## EXAMPLES 131 132 ### Migrate unpushed commits 133 134 The migrate command's most common use case is to convert large git objects to 135 LFS before pushing your commits. By default, it only scans commits that don't 136 exist on any remote, so long as the repository is non-bare. 137 138 First, run `git lfs migrate info` to list the file types taking up the most 139 space in your repository. 140 141 ``` 142 $ git lfs migrate info 143 migrate: Fetching remote refs: ..., done 144 migrate: Sorting commits: ..., done 145 migrate: Examining commits: 100% (1/1), done 146 *.mp3 284 MB 1/1 files(s) 100% 147 *.pdf 42 MB 8/8 files(s) 100% 148 *.psd 9.8 MB 15/15 files(s) 100% 149 *.ipynb 6.9 MB 6/6 files(s) 100% 150 *.csv 5.8 MB 2/2 files(s) 100% 151 ``` 152 153 Now, you can run `git lfs migrate import` to convert some file types to LFS: 154 155 ``` 156 $ git lfs migrate import --include="*.mp3,*.psd" 157 migrate: Fetching remote refs: ..., done 158 migrate: Sorting commits: ..., done 159 migrate: Rewriting commits: 100% (1/1), done 160 master d2b959babd099fe70da1c1512e2475e8a24de163 -> 136e706bf1ae79643915c134e17a6c933fd53c61 161 migrate: Updating refs: ..., done 162 ``` 163 164 ### Migrate local history 165 166 You can also migrate the entire history of your repository: 167 168 ``` 169 # Check for large files in your local master branch 170 $ git lfs migrate info --include-ref=master 171 172 # Check for large files in every branch 173 $ git lfs migrate info --everything 174 ``` 175 176 The same flags will work in `import` mode: 177 178 ``` 179 # Convert all zip files in your master branch 180 $ git lfs migrate import --include-ref=master --include="*.zip" 181 182 # Convert all zip files in every local branch 183 $ git lfs migrate import --everything --include="*.zip" 184 ``` 185 186 Note: This will require a force push to any existing Git remotes. 187 188 ## SEE ALSO 189 190 Part of the git-lfs(1) suite.