vscode-git-graph icon indicating copy to clipboard operation
vscode-git-graph copied to clipboard

filter graph by file/tree

Open robbuckley opened this issue 5 years ago • 9 comments

Describe the feature that you'd like

  1. commit graph when viewing the git graph, it would really help in understanding large repos if the repos file tree at the selected commit could be browsed in a sidebar window, and that the graph could be further filtered by selecting a subtree/file

  2. file browser sidebar window if a folder or file is selected, the commits in the graph are filtered according to the selection, so that only commits which affect that subtree / file are shown. In effect showing the history of all commit/branches which affect that file. When no file/folder is selected, the graph behaves as normal

robbuckley avatar May 09 '19 17:05 robbuckley

Thanks for making this suggestion! I'll leave this item as nice to have for now, as it is extremely complicated to implement, and although useful for some users, I'm not sure most users would actually use it.

If others would frequently use this functionality, please like this issue so I can keep track of community demand and re-prioritise it if/when necessary.

mhutchie avatar May 09 '19 22:05 mhutchie

Another small feature I'd like to add to this feature request is a "View file history" command in the file explorer context menu (just like "Open Timeline"). This command will open the graph window with the filter set to the selected file, as suggested in #366.

efaulhaber avatar Nov 14 '20 11:11 efaulhaber

I'm keen to have this feature, so I was having a bit of a play around with possibilities. While just adding the filter paths into the git log arguments (in DataSource.getLog()) breaks the graph, if you also add --parents it enables parent rewriting, which fixes it so that the graph is correct again. As the format of the log output is being explicitly specified, I think that adding --parents doesn't have any other affect on the output, meaning that the graph will still look correct regardless of whether filter paths are being specified or not. As the commit details data is taken from a separate query, the "parent commit" listed there is still correct, not the rewritten one from the filtered log.

That would cover the backend side of this feature, though there's still the issue of how to expose the option in the front end. I'm assuming that @mhutchie would want to provide a proper solution for this long term, but perhaps as a stopgap there could just be a text field somewhere in the UI to enter the paths, which would give us the extra functionality while the rest is figured out?

t-gehring avatar Dec 08 '20 13:12 t-gehring

Hi @t-gehring,

Thanks for doing this investigation, it’s pretty much the same conclusions I made back when this feature was first requested. It’s good to know what we found is consistent with each other.

FYI: Over the upcoming holiday period I’ve got a few weeks that I can spend working on the extension, and am aiming to work through many of the open feature requests, in particular tackling some of these more complicated bigger features that are highly requested. With a full-time job I’m able to keep up with the majority of the small / medium feature requests, but I’m only able tackle some of these larger features alongside my job.

mhutchie avatar Dec 08 '20 21:12 mhutchie

Hey, we work in a monorepo and it'd be so helpful to be able to filter the graph by directory. GitLens (or is it just built in to VSCode?) has this feature and it's been incredibly useful, but it only shows a list of commits without a graph. A graph from the perspective of commits that only touch a subset of the project would be amazing.

image

VickyKoblinski avatar Nov 24 '21 22:11 VickyKoblinski

The ability to show the commit graph for individual files and folders would indeed be extremely useful. GitLens has the functionality to show file/folder history, but unfortunately it often gets it wrong, showing commits that did not affect the file/folder ( https://github.com/gitkraken/vscode-gitlens/issues/259 ). Having the ability in Git Graph instead and having it do it right would be a blessing.

mattiasbertilsson avatar Sep 08 '23 15:09 mattiasbertilsson

+1

SymphonySimper avatar Nov 22 '23 04:11 SymphonySimper