4 ms·
You could use `git log -p` instead of `git log` so that the diff is included. To navigate efficiently between the commits, you could pre-seed less with a regex
by Myrmornis 6y ago
You could use `git log -p` instead of `git log` so that the diff is included.
To navigate efficiently between the commits, you could pre-seed less with a regex that matches commit (and file) lines, so that "n" and "N" jump from one commit (or file) to the next, something like this
LESS="-R --pattern ^(commit|diff) " git log -p
Delta[1] makes this convenient: delta --navigate.
[1] https://github.com/dandavison/delta https://github.com/dandavison/delta
(Disclosure: I am the author of delta)
- jancsika 6y agoOoh, thanks. I think I can get away with git log -p to fetch the whole enchilada. There are just so many things in the git CLI that are a single step away from being usable by default. For example, in Gitlab by default you see a tag to let you know if a branch has been merged. I can do the same in cli by exploring my flag options, but that time adds up for every little convenience that happens to be missing. (And as Gitlab shows, it's not impossible to choose a set of default conveniences that cover the bases for an enormous percentage of the users.) I'll definitely look into that jumping pattern, too. Thanks for the hints!
- noir_lord 6y agoWow, this looks incredible. I currently use diff-so-fancy which is nice enough but as someone who looks at a lot of diffs a day this seems like a big upgrade.
- adz5a 6y agoHello, thanks for pointing out your tool. I use diff-so-fancy as a pager but I will most definitely try your tool.
- codys 6y agoThe one issue I've seen with using `-p` here is that `git log -p` has worse performance when compared to plain `git log` because it needs to calculate diffs, and when searching in less ends up searching the diff contents (even when this is not desired)
- paxswill 6y agoIf you know the specific string (or regex) you’re searching for in the commit messages, combining `-p` with one of the pickaxe [0] options might be a bit faster. 0: http://www.philandstuff.com/2014/02/09/git-pickaxe.html http://www.philandstuff.com/2014/02/09/git-pickaxe.html