github.com/psexton/git-lfs@v2.1.1-0.20170517224304-289a18b2bc53+incompatible/docs/man/git-lfs-prune.1.ronn (about) 1 git-lfs-prune(1) -- Delete old LFS files from local storage 2 =========================================================== 3 4 ## SYNOPSIS 5 6 `git lfs prune` [options] 7 8 ## DESCRIPTION 9 10 Deletes local copies of LFS files which are old, thus freeing up disk space. 11 Prune operates by enumerating all the locally stored objects, and then deleting 12 any which are not referenced by at least ONE of the following: 13 14 * the current checkout 15 * a 'recent branch'; see [RECENT FILES] 16 * a 'recent commit' on the current branch or recent branches; see [RECENT FILES] 17 * a commit which has not been pushed; see [UNPUSHED LFS FILES] 18 * any other worktree checkouts; see git-worktree(1) 19 20 In general terms, prune will delete files you're not currently using and which 21 are not 'recent', so long as they've been pushed i.e. the local copy is not the 22 only one. 23 24 The reflog is not considered, only commits. Therefore LFS objects that are 25 only referenced by orphaned commits are always deleted. 26 27 ## OPTIONS 28 29 * `--dry-run` `-d` 30 Don't actually delete anything, just report on what would have been done 31 32 * `--verify-remote` `-c` 33 Contact the remote and check that copies of the files we would delete 34 definitely exist before deleting. See [VERIFY REMOTE]. 35 36 * `--no-verify-remote` 37 Disables remote verification if lfs.pruneverifyremotealways was enabled in 38 settings. See [VERIFY REMOTE]. 39 40 * `--verbose` `-v` 41 Report the full detail of what is/would be deleted. 42 43 ## RECENT FILES 44 45 Prune won't delete LFS files referenced by 'recent' commits, in case you want 46 to use them again without having to download. The definition of 'recent' is 47 derived from the one used by git-lfs-fetch(1) to download recent objects with 48 the `--recent` option, with an offset of a number of days (default 3) to ensure 49 that we always keep files you download for a few days. 50 51 Here are the git-config(1) settings that control this behaviour: 52 53 * `lfs.pruneoffsetdays` <br> 54 The number of extra days added to the fetch recent settings when using them 55 to decide when to prune. So for a reference to be considered old enough to 56 prune, it has to be this many days older than the oldest reference that would 57 be downloaded via `git lfs fetch --recent`. Only used if the relevant 58 fetch recent 'days' setting is non-zero. Default 3 days. 59 60 * `lfs.fetchrecentrefsdays` <br> 61 `lfs.fetchrecentremoterefs` <br> 62 `lfs.fetchrecentcommitsdays` <br> 63 These have the same meaning as git-lfs-fetch(1) with the `--recent` option, 64 they are used as a base for the offset above. Anything which falls outside 65 of this offsetted window is considered old enough to prune. If a day value is 66 zero, that condition is not used at all to retain objects and they will be 67 pruned. 68 69 ## UNPUSHED LFS FILES 70 71 When the only copy of an LFS file is local, and it is still reachable from any 72 reference, that file can never be pruned, regardless of how old it is. 73 74 To determine whether an LFS file has been pushed, we check the difference 75 between local refs and remote refs; where the local ref is ahead, any LFS files 76 referenced in those commits is unpushed and will not be deleted. This works 77 because the LFS pre-push hook always ensures that LFS files are pushed before 78 the remote branch is updated. 79 80 See [DEFAULT REMOTE], for which remote is considered 'pushed' for pruning 81 purposes. 82 83 ## VERIFY REMOTE 84 85 The `--verify-remote` option calls the remote to ensure that any LFS files to be 86 deleted have copies on the remote before actually deleting them. 87 88 Usually the check performed by [UNPUSHED LFS FILES] is enough to determine that 89 files have been pushed, but if you want to be extra sure at the expense of extra 90 overhead you can make prune actually call the remote API and verify the 91 presence of the files you're about to delete locally. See [DEFAULT REMOTE] for 92 which remote is checked. 93 94 You can make this behaviour the default by setting `lfs.pruneverifyremotealways` 95 to true. 96 97 In addition to the overhead of calling the remote, using this option also 98 requires prune to distinguish between totally unreachable files (e.g. those that 99 were added to the index but never committed, or referenced only by orphaned 100 commits), and files which are still referenced, but by commits which are 101 prunable. This makes the prune process take longer. 102 103 ## DEFAULT REMOTE 104 105 When identifying [UNPUSHED LFS FILES] and performing [VERIFY REMOTE], a single 106 remote, 'origin', is normally used as the reference. This one remote is 107 considered canonical; even if you use multiple remotes, you probably want to 108 retain your local copies until they've made it to that remote. 'origin' is used 109 by default because that will usually be a master central repo, or your fork of 110 it - in both cases that's a valid remote backup of your work. If origin doesn't 111 exist then by default nothing will be pruned because everything is treated as 112 'unpushed'. 113 114 You can alter the remote via git config: `lfs.pruneremotetocheck`. Set this 115 to a different remote name to check that one instead of 'origin'. 116 117 ## SEE ALSO 118 119 git-lfs-fetch(1) 120 121 Part of the git-lfs(1) suite.