jonas / tig

Text-mode interface for git
https://jonas.github.io/tig/
GNU General Public License v2.0
12.48k stars 611 forks source link

history of moved files not displayed properly #1277

Closed RafalSkolasinski closed 1 year ago

RafalSkolasinski commented 1 year ago

I often use

tig -- path/to/some/file

to easily view history of changes of a given file.

This unfortunately does not work if file has been moved around (even if git properly registered the file renaming) and the result shown looks like file would only be created at the commit when it was moved (renamed).

Note: this is on Ubuntu 22.04 with tig 2.5.1

koutcher commented 1 year ago

Try tig --find-renames --follow -- path/to/some/file. You can set it permanently using log-options in .tigrc but it was not turned on by default for performance reasons.

RafalSkolasinski commented 1 year ago

Nice! I did not find it in --help - it may be missing from it.

tig 2.5.1 

Usage: tig        [options] [revs] [--] [paths]
   or: tig log    [options] [revs] [--] [paths]
   or: tig show   [options] [revs] [--] [paths]
   or: tig reflog [options] [revs]
   or: tig blame  [options] [rev] [--] path
   or: tig grep   [options] [pattern]
   or: tig refs   [options]
   or: tig stash
   or: tig status
   or: tig <      [git command output]

Options:
  +<number>       Select line <number> in the first view
  -v, --version   Show version and exit
  -h, --help      Show help message and exit
  -C<path>        Start in <path>

Unfortunately I just tried it and though it shows now changes to the file before rename it also starts to show changes to other files (in my case it was git mv on the whole directory).

koutcher commented 1 year ago

Keep in mind Tig is a front-end to present Git commands results in a more efficient way, these options are from Git, not from Tig. See man git-log.