From 289908ca2666652262de6a939c0c4722eb7c59ac Mon Sep 17 00:00:00 2001 From: risk danger olson Date: Wed, 13 Sep 2017 16:42:28 -0600 Subject: [PATCH] add some examples --- docs/man/git-lfs-migrate.1.ronn | 60 ++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/docs/man/git-lfs-migrate.1.ronn b/docs/man/git-lfs-migrate.1.ronn index dc54adf0..9cd4c351 100644 --- a/docs/man/git-lfs-migrate.1.ronn +++ b/docs/man/git-lfs-migrate.1.ronn @@ -111,9 +111,67 @@ The following configuration: Would, therefore, include commits: F, E, D, C, B, but exclude commit A. -The presence of flag --everything indicates that all local references should be +The presence of flag `--everything` indicates that all local references should be migrated. +## EXAMPLES + +### Migrate unpushed commits + +The migrate command's most common use case is to convert large git objects to +LFS before pushing your commits. By default, it only scans commits that don't +exist on any remote. + +First, run `git lfs migrate info` to list the file types taking up the most +space in your repository. + +``` +$ git lfs migrate info +migrate: Fetching remote refs: ..., done +migrate: Sorting commits: ..., done +migrate: Examining commits: 100% (1/1), done +*.mp3 284 MB 1/1 files(s) 100% +*.pdf 42 MB 8/8 files(s) 100% +*.psd 9.8 MB 15/15 files(s) 100% +*.ipynb 6.9 MB 6/6 files(s) 100% +*.csv 5.8 MB 2/2 files(s) 100% +``` + +Now, you can run `git lfs migrate import` to convert some file types to LFS: + +``` +$ git lfs migrate import --include="*.mp3" --include="*.psd" +migrate: Fetching remote refs: ..., done +migrate: Sorting commits: ..., done +migrate: Rewriting commits: 100% (1/1), done + mp3 d2b959babd099fe70da1c1512e2475e8a24de163 -> 136e706bf1ae79643915c134e17a6c933fd53c61 +migrate: Updating refs: ..., done +``` + +### Migrate local history + +You can also migrate the entire history of your repository: + +``` +# Check for large files in your local master branch +$ git lfs migrate info --include-ref=master + +# Check for large files in every branch +$ git lfs migrate info --everything +``` + +The same flags will work in `import` mode: + +``` +# Convert all zip files in your master branch +$ git lfs migrate import --include-ref=master --include="*.zip" + +# Convert all zip files in every local branch +$ git lfs migrate info --everything --include="*.zip" +``` + +Note: This will require a force push to any existing Git remotes. + ## SEE ALSO Part of the git-lfs(1) suite.