| 1 | = History of an individual file = |
| 2 | Text mode |
| 3 | {{{ |
| 4 | git log -p <filename> |
| 5 | }}} |
| 6 | |
| 7 | Graphically |
| 8 | {{{ |
| 9 | gitk <filename> |
| 10 | }}} |
| 11 | |
| 12 | = Find revision by date = |
| 13 | This is kind of obtuse, and I really recommend {{{ git log }}} or {{{ gitk }}}. If you insist: |
| 14 | {{{ |
| 15 | git rev-list -n 1 --before="2009-07-27 13:37" master |
| 16 | }}} |
| 17 | This finds one revision (-n 1) before a certain date. You can use this with {{{ git checkout }}} (see below). |
| 18 | |
| 19 | = Check out old version of a file = |
| 20 | Find the old revision by using {{{ git log }}} (see above). |
| 21 | {{{ |
| 22 | git checkout <revision> <file> |
| 23 | }}} |
| 24 | |
| 25 | Reverting to the current version (HEAD): |
| 26 | {{{ |
| 27 | git checkout HEAD <file> |
| 28 | }}} |