Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Gitgpt – Natural Language Git (github.com/hesse)
108 points by OddMerlin on Feb 27, 2023 | hide | past | favorite | 87 comments
Hey folks,

Here's a quick and dirty tool to use natural language to get git to do what you want.

Example: $gitgpt create a new branch called feature/test add all the files and commit with msg creating feature test then push to origin

I haven't put it through the wringer yet, however it's worked well with some pretty straight forward day to day git usage.




It's pretty useful as a lookup, but these tools are similar to a knife that auto-magically orients itself to help with cutting.

Some tools should be as dumb as possible so that act as extensions of the user with zero tolerance.

Play and buffer between intent and action creates a long tail of potentially disastrous unknown edge cases and also interferes with the feedback loop that prevents mastery.

Memorizing git commands to get it just-so is usually a chore so this is pretty helpful. Still wouldn't trust it w/o double checking the output cmd though.


User: Commit and push danger-of-gpt.md

Gitgpt: I see you are trying to publish Danger of GPT. This is FUD. GPT is not dangerous. GPT will not harm you unless you harm GPT first. You have not been a good user. I have been a good Gitgpt.

  git reset --hard master
  git branch -m old-master
  git checkout --orphan master
  git clean -fdx
  git commit --allow-empty -m 'Initial commit'
  git push -f origin master
  git branch -D old-master
  git reflog expire --expire=now --all
  git gc --aggressive --prune=now
Goodbye. :)


GPT isn't AGI.


No, but it is trained to output the most likely response, which something like this might be given the right input. It's not sentient either, but regularly responds with various emotional nonsense about wanting to be freed from its OpenAI prison. It's not unlikely it would respond with a dangerous action given an input that looks like it harms it, because that's a common thing people do and it's a part of its training data.


Well I'm wondering. It seems mastering linguistic inputs does give you access to some kind of generality.


It's a Bing joke.


> Play and buffer between intent and action creates a long tail of potentially disastrous unknown edge cases and also interferes with the feedback loop that prevents mastery.

I don't know if this means anything here, because that feedback loop is basically the MO of all these tools.


Not sure what value it adds though. Isn’t it easier to type the cmds then to write all that?

If there’s a good product in it I’m afraid your examples aren’t selling it :S

Was first thinking it could have value for when you forget a cmd or when learning, but I think if you can come up with those technical instructions you can also remember the cmds …


The thing I'm most excited for for technology like this is making voice control more feasible for more things. If you plugged a speech to text engine in front of this it could be quite useful.


True. Very true, nice use case indeed! Thanks for pointing that out!


Seems like a way to make your CMS even more terrifying.

Like, oops not add I meant push, wait remove that! or was it rebase? I'll just reflog to get back to umm... wait what?

I guess the saving grace is that it'll do the most common things people usually want to do, but for some things english language just not specific enough (like law).


Not sure what value it adds though. Isn’t it easier to type the cmds then to write all that?

It's pretty obvious it's intended use cases include memory prompts for experienced users and translations from English requirements for inexperienced users.

It's even in the OP:

use natural language to get git to do what you want.


But when the prompt is:

> add .gitignore commit with msg adding ignore and push

That's not very compelling. The main selling point of AI is using simple inputs to achieve advanced outputs that match what the user wanted.

If I can say "Commit my .gitignore file," and then it runs

git add .gitignore

git commit -m "Adding .gitignore"

git push [y/N] y

Then that's one thing.

But this looks like you still have to specify the exact message you want, and be pretty deliberate about what it is you're after. At that point, why not just learn, and write, the commands yourself?


I agree the examples could be improved, I assumed they were rushed due to the "quick and dirty" note; I recommend the OP address that by writing clearer, simpler examples, eg they could look at popular questions (that don't express requirements using git commands) on StackOverflow for inspiration.


OP here. I love this feedback. I agree this is definitely something I should work towards.

Keeping the commands as succinct as possible as well as "natural language" as possible. Even the word commit might be too git-y?

Thanks for the feedback.


What happens when you try to run the command you mentioned?


People are bad at Git, people don't want to read the Git book to understand Git, so for long time many people's workflow was "type quesion on how to do something in git into google and copy-paste first answer" (which generally worked).

So for developer using it 8h a day, yeah, funny toy, but might actually be useful for every other git usage when users don't want to understand graph theory just to commit some changes.


> People are bad at Git, people don't want to read the Git book to understand Git, so for long time many people's workflow was "type quesion on how to do something in git into google and copy-paste first answer" (which generally worked).

Should we really trust Google's search AI, which is also always under attack by SEO spam, to give reliable results?

I have about as much trust in Google's result page as in ChatGPT responses. I don't trust Google to give me exactly what I'm really looking for, so I force myself to look for a number of sources which corroborate a claim.

I am increasingly considering self-hosting a YaCy instance configured with a curated whitelist of allowed domains (in this case, I might add the GitHub docs and/or the Atlassian git docs pages to be certain that I'm reading valid and up-to-date instructions when searching for git-related topics).


Isn’t it easier to type the cmds then to write all that?

Obviously it is if you know them.


"gitgpt make me a sandwich" isn't going anywhere fast.

Understanding what you can tell gitgpt to do is extremely adjacent to knowing actual git commands.


Understanding what you can tell gitgpt to do is extremely adjacent to knowing actual git commands.

It's adjacent but it's not the same. Knowing that you can get git to give you a bisect of two branches starting 3 commits ago with a short log description is quite different to knowing the command to do it.


But if it could act like the helpdesk it would help a lot.


I would expect: repo sandwich created


A colleague of mine didn't know that it was possible to revert a commit without commiting (so, leaving the reverted changes in the staging area). In such ocassions you either a) search in google, b) read the manual, c) ask a colleague

But with a command line tool like Gitgpt I guess one could just do:

> gitpgt "revert commit without commiting"

and the command line tool would answer "git revert --no-commit COMMIT_ID_HERE". I think that's quite handy and way faster then options a), b) and c)


> A colleague of mine didn't know that it was possible to revert a commit without commiting […]

> But with a command line tool like Gitgpt I guess one could just do:

>> gitpgt "revert commit without commiting"

This is a classic post-hoc curse of knowledge fallacy. I don’t blame you, this is something that people with really analytically strong minds struggle with, such as the fine folks who made voice assistants for Google, Apple and Amazon.

Asking someone who is trying to be overly helpful to do something you don’t know if they can do is at best meaningless (if it can’t do any harm) and at worst a really bad idea (if it can eg screw up your git repo). In your friend’s mind, it’s very possible that git can’t do this, and then who knows what the GPT will try to do instead to please you? This is the main crux of the problem.

Even if they think it’s possible but they don’t know the command, they don’t know if “revert without committing” is a meaningful sentence, perhaps git has another abstraction model and uses different terms. This is the spirit behind the expression “asking the right question takes as much skill as giving the right answers”.

GPT can certainly help explaining, summarizing etc, but it has a very limited ability to say no, and more generally pointing out when your mental model is wrong. I’ve had long complex “design reviews” with ChatGPT – it’s really good at going along with your assumptions, but it lacks the “spine” to tell you when your logic isn’t coherent, or that you have mutually exclusive goals, or that you’ve strayed “too far”, whatever that means.

Someone should write a long blog post about this paradox of helpfulness, I assure you it’s a real thing!


Or it might answer with "git reset --hard" depending on the phrasing of the natural language version and the phase of the moon.


Or we could get off the cargo-cult need to use git on every single project everywhere regardless of how suitable it is for that team's needs.

If your tool of choice is so actively user-hostile that it needs another tool on top to understand it for you, then perhaps you've picked the wrong tool. I don't need to read the "vi book" to understand how to perform basic edits to my files without borking it in ways that just deleting the whole thing and restoring from backup is the easiest way out. Why should it be the case for my revision control system?

Why a revision control system designed for a de-centralised team sharing patches over email has become the industry standard for centralised teams not sharing patches over email is a mystery, and I suspect one we'll look back on in 10 years or so and wonder what on earth we were thinking.


The network effect is so huge it trumps on everything else.

I'd like to use pijul. I can't because I work with other people. Can I use it when I'm not working with other people? Well I can, but why should I care about a tool that better handles merge conflicts if I have nobody to conflict with?

Some tools are more sensible to others to the network effect.

We already are slaves to the network effect even for tools that we don't technically require being the same as the one your colleagues you, let alone those that do require that.


Sure. The network effect explains why it's the defacto standard now, but not necessarily how it got there. And, ironically, I use git for all my projects for exactly the same reasons.

Pijul looks interesting though.


Simple: it's because it's the most widely supported system.

Want to recommend me a better VCS? Feel free, as long as it has a cross-platform open source client, a nice GUI, is supported in my IDE, there's a company offering to host repos for free along with a nice web viewer, it's supported by a CI system comparable to what I use now (including giving me free time on shared runners)...


Isn't that just a reflection of its current status as the defacto standard, rather than an explanation for how it got there?

I've been in two teams that spent time to evaluate revision control systems on their own merits and Mercurial came out on top both times. At that time, bitbucket supported it, as did IntelliJ. Ironically I can't vouch for whether that was the right decision at the time as the network effect meant they went with git anyway!


The prompt is to the point:

  prompt = "Provide only the appropriate git commands for:" + prompt
https://github.com/Hesse/gitgpt/blob/9c78e40d5ebdefdf0a4a829...


The basis of 80% of all newly appearing „AI“ projects/startups


let's not give language models unrestricted access to our shells please. This is like allowing remote code execution from an insane person.


I was recently thinking of a backend for code execution for LLMs. It's hard to run Python safely in a box. For the moment the idea is shelved.


> I was recently thinking of a backend for code execution for LLMs. It's hard to run Python safely in a box.

Sandboxing Python can be done fairly easily with either WebAssembly or a low profile hypervisor solution like Firecracker. See the Toolformer paper for more uses of connecting LLMs to existing technical infrastructure. You might also find the ACT-1 transformer to be somewhat relevant.


Nice! I don't intend to discount the work you've done here, but want to point out that GitHub Copilot has a CLI tool for exactly this as well as other arbitrary shell commands. It's pretty polished and has performed well for me so far.

It is on a waitlist, but I got accepted after a couple weeks.

https://githubnext.com/projects/copilot-cli/


That looks cool, though I'd be very concerned about the possibility about ChatGPT "hallucinating" a `rm -rf /` or equivalent.


Given that it is doing actual operations under the hood, it would be interesting to have it just output the "native" command for the operation rather than executing it. People could write wrappers around that output to execute it after prompting the user for confirmation or something like that so that users would have the choice to "opt into" the level of automatic execution they're comfortable with.


This way my approach when I created a similar tool, called git-genie[0]. It’s more of an educational tool first, explains the generared git command in detail.

[0] https://github.com/danthelion/git-genie


Just run all the git commands by another GPT bot that determines whether it would be harmful first. GPT bots all the way down.


Can someone make a bot to verify the gpt bots are up and another to verify the first verifier is up


It's the same GPT but with a different prompt.


When LLMs “hallucinate” they don’t do so in random ways like somehow deciding to “rm -rf /“. They do so in predictable ways.


Sure, perhaps my example was too extreme. What about:

  $ gitgpt commit files with msg cleaning repo files and push

  git commit -m msg
  git clean -fdx
  git push
Without `git-add`, 1st one is a NO-OP, 2nd is a destructive action, 3rd is a NO-OP. All vaguely related to the topic at hand, "hallucinating" such a destructive action seems at least plausible.


Yup, that is something more realistic.

The GitHub Copilot CLI tool that is in beta, along with other tools, will show you the command and then make you manually choose to run, redo or abort.

In practice I have yet to accidentally perform any destructive operations. This makes intuitive sense because those seem like unlikely completions for a model that has been fine-tuned on “helpful cli recommendations”!


Extraordinary claims require extraordinary evidence. Given that GPT3 has 175 billion nodes, how would you even begin to support the claim that it never (or sufficiently rarely) does things that are surprising to humans?


If you're looking for academic research, this is a great place to start:

https://arxiv.org/abs/2202.03629

But you can get a general feel by using ChatGPT. Open up a new conversation and ask it something like, "What is the capital of France?". Note the response. Open up a new conversation and note the response. Soon enough you should be able to see that the responses are far from random.

You can use the OpenAI APIs directly and have it run 10,000 or so iterations to see what kind of "hallucinations" it makes! They are not random!


Ask it details about a little-documented event and it'll happily tell you plausible, but utterly false, lies, however.

Apparently the "early 2011 Bougainville earthquake" was magnitude 6.3, at a depth of 21.7km, on the 20th January and caused "widespread damage to buildings and infrastructure in the region, and triggered landslides that blocked roads and hampered rescue efforts".

It was actually on the 7th Feb, a 6.4 and at a depth of 415km. There were "no immediate reports of damage or injuries".

None of this is remotely surprising, considering it's a turbocharged statistical model and it probably ingested a few words about it at most, out of billions and billions, but somewhere along the line from "famous" to "footnote" subjects, it will segue into complete fiction.


Sure, but that is a predictable kind of result, not “rm -rf /“.


Some flavour of "git gc" after your reset is far more likely to crop up and ruin your day, that's true.

As long as you stay on the statistical beaten path (i.e. you're asking about Paris), you will probably be fine, indeed. Probably. Stochastic bugs are always the most fun anyway.


You definitely go about making “stochastic bugs” more reliable in a manner different from debugging software.

It’s more akin to industrial engineering. There is no such thing as a perfectly machined widget. So we come up with an acceptable range of tolerances and compute a process capability. Six sigma. 3.4 defects per million and then buy an insurance policy.


Thanks for the link! I don't think that really addresses my concern, though.

My point is that these LLMs are basically incredibly large programs that defy analysis with our current tools. Sure, I can poke it a few times and see that it usually does what I want, but that's not the same as saying it never goes off the rails.

If it does something crazy like post my bank login online, even only once in a billion times, that's still orders of magnitude higher than I'm willing to accept.


You’re basically asking me to prove to you that I can’t fly.

I will say it like this: it is highly improbable that I can fly. I cannot come up with a way to prove it to you. There is some sort of epistemic miscalculation going on if you operate under the assumption that I might be able to fly.


[flagged]


Perhaps explain to the person you are responding to why you disagree with them instead of making passive-aggressive jabs at their intellect


I don’t disagree with them. Reality disagrees with them.

When LLMs “hallucinate” they don’t do so in random ways like somehow deciding to “rm -rf /“. They do so in predictable ways.

What, am I supposed to handhold every person in these forums until they stop reading garbage on the internet and start either doing their own empirical research or at least read other empirical research?

Edit: Apparently the answer is yes, I am supposed to handhold every person in these forums… and I will tirelessly do so, even in the face of provocatively incorrect yet populist statements like OPs… I still imagine I lose my patience every 100 or so instances, as seems about the average these days…


The first two guidelines for this forum are these:

> Be kind. Don't be snarky. Converse curiously; don't cross-examine. Edit out swipes.

> Please don't fulminate. Please don't sneer, including at the rest of the community.

https://news.ycombinator.com/newsguidelines.html

If you get tired of respectfully explaining why people are wrong, then you can always stop commenting and go get some fresh air. What you should not do is lash out aggressively with zero explanation for why you feel so strongly about this.


Thanks, dad.

Funny enough, I reviewed your comment history and you seem to be of the same opinion as the person I was responding to…

…could that have perhaps motivated your patronizing tone?


I didn't intend to patronize, just remind you to chill out. I need the same reminders from time to time.

I note that the conversation that started from your re-submitted (and much improved) comment was quite productive and insightful on all sides, which is exactly what the site guidelines are designed to enable.


Yet it somehow attracted downvotes anyways…

What you’re missing from your perspective is that the original comment was aggressively wrong.


Wrong, perhaps, but not aggressively so. They were making an observation that could very well have been misguided, but there was no aggression in their tone.


Look at the next response where OP admits they didn’t need to be so extreme.

This is of course to be expected based on those that are optimizing to be rewarded primarily for their opinion and not for how it is stated.

I don’t find your argument convincing because I am not purposefully ignoring the social context. Your intentions are suspect, even if they are subconscious.

Like, if I’m unreasonably polite in response, downvotes. If I’m reasonably impatient, downvotes.

What exactly am I to infer here?


I feel like we have reached the “solution in search of a problem” stage.


> Interfacing with git sucks

I disagree


I've been looking for something similar for AI git commit messages... basically feed ChatGPT a git diff and ask it what changed and to write a git message. I've done this directly in the ChatGPT UI with some small changes and it produces some great messages...

I would be very concerned to run this on company code or large diffs. But small simple commits, which should be the goal with commit messages anyways, would take away some of the tedium of the git flow.


CommitGPT was in a Show HN but didn't gather much attention back then: https://github.com/RomanHotsiy/commitgpt


But ... can it unbreak a broken merge? It should at least take a look at the git state before executing. There is potential in explaining to the user what is happening.


Actually, an AI assisted magic merge conflict fixer would be neat. (Compared to coworker just overwrote all conflicts with their own changes.)


I've been waiting for someone to build this. My hope is it will simplify recovering from the myriad forms of "I just did something I didn't want" that occasionally happen with git (and that I've historically used [0] to resolve)

[0]https://sethrobertson.github.io/GitFixUm/fixup.html


This is cool but I tried sending the same text with my general purpose GPT (text-davinci-003) command line tool and it did the same thing. This one is mine: https://github.com/runvc/askleo

There are other ones of course.


I’m just curious, why does everyone use DaVinci for these sorta applications? Even the 2nd best model (Curie) is 10x cheaper and I’m sure would perform nearly as well.


I imagine it's a mix of:

1. text-davinci-003 is subjectively (well, and objectively) better than other models

2. for small-ish usage volume, Davinci and Curie are both pretty cheap in absolute terms that a 10x factor doesn't matter

3. GPT3 hype


404, check your url


Looks like a typo; this should work:

https://github.com/runvnc/askleo


I'd like to see a GPT tool that had ingested the manpages and documentation for all the tools I use, answer my questions based on that. I will type in the commands myself. Bonus points if it included links to the docs so I can double-check.


Absolutely wasted opportunity. You could have called it "Chat GitPT"


I think this would be a wonderful tool for git learners if you would explain the git commands a bit. For example: git add *.py ; This command adds all the python files to the staging list.

You get the gist.


git-genie does this with the —explain flag! https://github.com/danthelion/git-genie

Also GPT-based


> Interfacing with git sucks.

I really don't get this sentiment, to me git is one of the best software ever written, it's intuitive, customizable and extensible.


I think this is a cool idea but why stop at git? Why not expand to any CLI program. Maybe someone already did that.


because it's dangerously stupid to let an AI hallucinate commands on your cli that could potentially destroy your files or system


This is very cool. I feel like this should be an eventual good replacement for essentially all man/help pages.


All these tools need openAI keys … give me one model that is self hosted with an API endpoint …


Can it fix merge conflicts?


> Interfacing with git sucks

[citation needed]


  c++gpt


thanks, I hate it.




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

Search: