|
| 1 | +git-recover: recover deleted files in your repository |
| 2 | +=========== |
| 3 | + |
| 4 | +`git-recover` allows you to recover some files that you've accidentally deleted |
| 5 | +from your working directory. It helps you find files that exist in the |
| 6 | +repository's object database - because you ran `git add` - but were never |
| 7 | +committed. |
| 8 | + |
| 9 | +Getting Started |
| 10 | +--------------- |
| 11 | + |
| 12 | +Running `git-recover` without any arguments will list all the files (git |
| 13 | +"blobs") that were recently orphaned, by their ID. (Their filename is not |
| 14 | +known.) |
| 15 | + |
| 16 | +You can examine these blobs by running `git show <objectid>`. If you |
| 17 | +find one that you want to recover, you can provide the ID as the argument |
| 18 | +to `git-recover`. You can specify the `--filename` option to write the |
| 19 | +file out and apply any filters that are set up in the repository. For |
| 20 | +example: |
| 21 | + |
| 22 | + git-recover 38762cf7f55934b34d179ae6a4c80cadccbb7f0a --filename shattered.pdf |
| 23 | + |
| 24 | +You can also specify multiple files to recover, each with an optional output |
| 25 | +filename: |
| 26 | + |
| 27 | + git-recover 38762c --filename one.txt cafebae --filename bae.txt |
| 28 | + |
| 29 | +If you want to recover _all_ the orphaned blobs in your repository, run |
| 30 | +`git-recover --all`. This will write all the orphaned files to the current |
| 31 | +working directory, so it's best to run this inside a temporary directory |
| 32 | +beneath your working directory. For example: |
| 33 | + |
| 34 | + mkdir _tmp && cd _tmp && git-recover --all |
| 35 | + |
| 36 | +By default, `git-recover` limits itself to recently created orphaned blobs. |
| 37 | +If you want to see _all_ orphaned files that have been created in your |
| 38 | +repository (but haven't yet been garbage collected), you can run: |
| 39 | + |
| 40 | + git-recover --full |
| 41 | + |
| 42 | +Options |
| 43 | +------- |
| 44 | + git-recover [-a] [--full] [<id> [-f <filename>] ...] |
| 45 | + |
| 46 | +`-a`, `--all` |
| 47 | +Write all orphaned blobs to the current working directory. Each file will |
| 48 | +be named using its 40 character object ID. |
| 49 | + |
| 50 | +`--full` |
| 51 | +List or recover all orphaned blobs, even those that are in packfiles. By |
| 52 | +default, `git-recover` will only look at loose object files, which limits |
| 53 | +it to the most recently created files. Examining packfiles may be slow, |
| 54 | +especially in large repositories. |
| 55 | + |
| 56 | +`<id>` |
| 57 | +The object ID (or its abbreviation) to recover. The file will be written to |
| 58 | +the current working directory and named using its 40 character object ID, |
| 59 | +unless the `-f` option is specified. |
| 60 | + |
| 61 | +`-f <filename>`, `--filename <filename>` |
| 62 | +When specified after an object ID, the file written will use this filename. |
| 63 | +In addition, any filters (for example: CRLF conversion or Git-LFS) will be |
| 64 | +run according to the `gitattributes` configuration. |
| 65 | + |
| 66 | +Getting Help and Contributing |
| 67 | +----------------------------- |
| 68 | +To report bugs, get assistance or provide a bug fix to this program, |
| 69 | +check it out on [GitHub](https://github.com/ethomson/git-recover/). |
| 70 | + |
| 71 | +Copyright (c) [Edward Thomson](http://edwardthomson.com/). All rights reserved. |
| 72 | + |
| 73 | +git-recover is open source software and is available under the MIT license. |
| 74 | +Please see the included `LICENSE` file for more information. |
0 commit comments