2

I'd like to find commits touching specified path in a magit-log buffer. Gitk has this as a filter "touching paths".

Is there a way to do this in Magit?

I usually run gitk --all or gitk mybranch otherbranch when I need to find something in a repo; ie) while debugging and looking for some clue. Anyway, after I run gitk I decide to filter, say, by a directory. So, I insert the name of the directory in the filter text box, and select "touching paths" to highlight the commits touching the path.

Because a successive commit not touching the path often time gives me a hint, I don't want to hide the commits by the filter. Even without hiding, I can easily jump from a commit to another commit by "↓" or "↑".

1 Answer 1

3

From the magit status buffer, after pressing l once, you can configure the log. To filter for 'touching paths' you can use -- and type (part of) the path for which you want commits touching it to be included in the log. After you have finished configuring, you can press l again to show the log.

5
  • Thanks! It's under "History simplification" "-- Limit to files". Actually, it does like pathspec on git log. What I meant by "Gitk filer" is not to hide unmatched commits but to highlight them. Commented Sep 29, 2021 at 23:39
  • Ah okay. Maybe you can explain what you are doing in gitk to achieve this? Commented Sep 30, 2021 at 1:43
  • I've added paragraphs. Hope it helps. Commented Sep 30, 2021 at 12:35
  • Ah thanks. Okay, that is a nice feature of gitk. I don't think magit offers an equivalent for that. But maybe you can make a feature request for it. I guess it would not be too much work to implement it (for the knowledgeable). Unfortunately for people like me, the code of magit indeed (as its name implies) looks like magic... Commented Sep 30, 2021 at 17:09
  • 1
    Maybe you are aware of this already, but you can quickly open gitk from magit by pressing ! k Commented Sep 30, 2021 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.