jesseduffield / jesseduffield/lazygit

Filter using `git log -L`

Open
#3,543 2 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

`git log -L` enables us to see the history of commits for the range of lines we pass to it:
https://git-scm.com/docs/git-log#Documentation/git-log.txt--Lltstartgtltendgtltfilegt

I use it with Neovim's visual mode to see how a piece of code changed over time and who made those changes.

As an example, I'm using neogit for it:
```lua
{
"gl",
function()
local file = vim.fn.expand("%")
vim.cmd([[execute "normal! \"]])
local line_start = vim.fn.getpos("'<")[2]
local line_end = vim.fn.getpos("'>")[2]
require("neogit").action("log", "log_current", { "-L" .. line_start .. "," .. line_end .. ":" .. file })()
end,
desc = "Neogit Log for this range",
mode = "v",
},
```

It would be great if I could see it in a lazygit window.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.