Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What would be nice is to add to this a way to plug language specific semantic analysers. Then it could be possible to do queries like "which commits did changes to a specific function" and so on.


That's in some sense already native git functionality.

(Though I recognize that the entire askgit here is essentially a layer on top of some existing functionality).

But changes to a specific function is a particularly underused feature in git.

You do `git log -L :nameOfFunction:fileItLives.ext` and git will show you changes to the function over time.

Of course that syntax is completely arcane (which contributes to its underuse), but e.g. for Python I just wrote a trivial thing to let me instead write `git pylog foo.bar.baz` and it translates to the right syntax above (that lives here: https://github.com/Julian/dotfiles/blob/76bd63f6c9a2c650c185...)


I have always wondered why GitHub doesn't add such functionality, its a no-brainer how much it would help to have a way to right-click a function and see how has it changed through history, it could use an interface where you scroll through time (eg the most you scroll the older versions you see, until you reach when it was created); same thing for files.


maybe some day after their search develops even the faintest idea of what programming language lexemes look like.


Presumably you’ve heard about git-blame, which is available on GitHub.


Yeah, I find it of little use due being syntax agnostic (e.g can't tell me about the changes on a function because it doesn't know what a function is). If you are taking about me asking the same for "files" I meant being able to see all the versions of a file in a single page (maybe using "infinite scroll" in case there are too many)


I'm the creator of AskGit - and this is something I've been thinking a bit about, unsure of the best way to implement and very open to ideas! Adding language specific analysis (this line is a comment, this is a function name, etc) is really interesting to me and I think could really kick this tool up a notch (there are still some more fundamental needs I'd like to address though, such as diffs and blames, query performance, etc).

I've been considering leveraging the syntax highlighting implementation in editors to make this possible (rather than something as heavy handed as parsing a "universal" AST, though I know there are projects to do this)...


Visual Studio has a limited version of what you want: if you start with a function it can show you the revision history.

https://docs.microsoft.com/en-us/visualstudio/ide/find-code-...

I think Rider has it as well.


Yep, jetbrains IDE's can show git history for a code selection. I've been finding it immensely useful.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: