I just tried that, and it seems to be the same as `git diff master experiment`. We don't want to diff the two heads. The command in Mercurial is `hg diff -r 'ancestor(master, experiment)' -r experiment`. Comrade trolor seems to have found the correct git expression.
Try git diff master...experiment (note there's three periods)
That works. Can you explain why? Does diff see this as a single commit or as set of commits? If it sees it as a set, how does it decide what two commits to diff from that set? If it's just one, what does it decide to diff?
I'm kind of confused because gitrevisions(7) says the triple dot is symmetric difference, but exchanging master and experiment does not produce the same output from diff.
This might benefit from SQLite's Virtual tables: https://sqlite.org/vtab.html With Virtual Tables you can expose any data source as a SQLite table -- then you can use every SQL feature that sqlite offers. You can just tell sqlite how to iterate through your data with a few functions, with an option to push down filtering information for efficiency. You can also create your own aggregates, functions etc. Here's an art…
SQLite virtual tables for git would be phenomenal - you could join your git history against data from other sources! And you wouldn't need to run a huge MySQL/Postgres server process to do it.
A very cursory search suggests no one has built this yet.
Try git diff master...experiment (note there's three periods)
That works. Can you explain why? Does diff see this as a single commit or as set of commits? If it sees it as a set, how does it decide what two commits to diff from that set? If it's just one, what does it decide to diff? I'm kind of confused because gitrevisions(7) says the triple dot is symmetric difference, but exchanging master and experiment does not produce the same output from diff.
Not so helpfully it has a different meaning in 'git diff' than in 'git log'. Basically, it means the difference in the second branch from the first common ancestor of the two branches.
My thoughts went straight to PostgreSQL Foreign Data Wrappers. Something like that would be really helpful!
Wouldn't that require a running Postgres server, though? Seems a bit heavy for ad hoc queries. For something like a GitLab server, though, that would be amazing.
Very cool. I always wanted to play around with a git provider for powershell. Powershell's syntax is great for queries and you could use everything that works on the normal file system with anything that has the abstractions implemented. The syntax seems close enough that this could just replace it, though: ls commits | where date
I'm no powershell guru, but I'm using posh-git [1]. Is it possible to chain commands using that tool?
But why does it have to look like SQL (and not like xpath or jquery)? Not many people enjoy writing SQL statements on the command line. It's verbose, the order of things is arbitrary...
I would assume that the whole point of the project is to be able to do SQLish queries on a git repo, and that it was written by and for people who are familiar with SQL and have a preference for it over other query languages. And they probably do enjoy writing SQL statements on the command line, however uncommon that may or may not be.
Thank you for sharing this. I was interested to know if this was a fork of gitql by cloudson. It is not. The following issue clarifies the relationship:
This is pretty cool. Looks like it's local to the current repo which makes sense for most usage. Having something like this across a swathe of repos would be useful in different ways (ex: " What has Bob committed over all the repos for our projects that involves the string 'billing'? ". Minor off topic rant about the animated example: Who doesn't put a space at the end of their prompt after the $?! Ugh!
Git map would work for many cases https://github.com/icefox/git-map Git map ql ...
Thank you for suggesting git-map. I tried it and intend to include it into my workflow. I thought your suggestion was a good one so I tested it. It did not work for me due to: "dyld: Library not loaded: libgit2.21.dylib". I assume this is something about my setup (mac, zsh, other stuff) but if you got this working I'd like to know so I can keep trying my with my setup. To clarify: both git-map and gitql work for me, I just can't seem to combine them.