5 ms·
A JavaScript implementation of Git
- amir734jj 6y agoBut why?
- maxthegeek1 6y agoSo that client side web applications can run git.
- blargmaster42_8 6y agoBut why!
- jpnelson 6y agoOften node modules need to depend on git to do developer experience things. Having it be available in node with no dependencies is really nice, you don't need to assume anything about the git in the environment your user is using.
- freeqaz 6y agoSee my comment here[0] for a real world use case! 0: https://news.ycombinator.com/item?id=25152185 https://news.ycombinator.com/item?id=25152185
- austincheney 6y agoIt says Android and iOS are supported environments. How would you execute a Node app on a phone?
- da_big_ghey 6y agoAt least on Android, Termux is pretty great: https://termux.com/ https://termux.com/
- crooked-v 6y agoIf it works in a browser, you can run it in a Webkit wrapper.
- ponker 6y agoWhy couldn’t you host a web app on a phone?
- ogre_codes 6y agoYou can include JS in iOS apps. You basically embed Javascript and call it directly from Swift/ ObjectiveC and it runs on the same Javascript engine that runs in Safari.
- austincheney 6y agoCan you run Node on iOS or Android?
- ogre_codes 6y agoI don't think you need to. Node is essentially a way to run Javascript from the command line. iOS provides a different way to run javascript. I think you just build the app similar to the way you bundle something for the web.
- clashmeifyoucan 6y agoI think you can additionally use it with React Native. I saw a cross-platform android/ios GitHub client using it.¹ [1] https://twitter.com/GitShark/status/1273043228355252224 https://twitter.com/GitShark/status/1273043228355252224
- DeathToWebDevs 6y agoJust use git from the command-line. I swear this is going to make me say a slur. I hate web developers so much.
- O_H_E 6y agoThis is not for end-users, this is for something like this:https://github.com/logseq https://github.com/logseq, or say github/gitlab to use. you need to chill, if you don't like something, don't use it. Easy
- distrill 6y agoYour neckbeard is showing. What does wanting to script git have to do with web?
- colejohnson66 6y agoOne should obviously only script with Bash. Never JS, Python, or whatever the cool kids are using these days! /s
- Seirdy 6y ago/unjerk Try POSIX sh and awk first; don't use bashisms or gawk features unless you need to.
- stoppatriarchy 6y agoWe just had a kerfuffle about fixing this in real git, but it looks like this repo still uses "master". Can we all just stop hating POC pls? A one-word change to avoid evoking centuries of bigotry is not that hard, so cope.
- O_H_E 6y agoI know isomorphic-git has been useful to a variety of projects. But may I ask what advantage does being pure JS have over writing a wrapper around the git executable?
- yaseer 6y agoIt's probably the most natural way of providing a browser-based git implementation, for systems like github/gitlab and browser-based IDEs. Browser-based coding is pretty popular these days, it seems.
- brundolf 6y agoThere may be some small platform-compatibility benefits even as a CLI since it can run anywhere JS can be interpreted But also: why not? It's cool, and it's probably a good learning resource for JS devs who want to learn how git works
- freeqaz 6y agoIt seems like the way Git deals with the filesystem is quite tightly coupled, and that component needs to be swapped out in a browser-based environment. When we looked into this, this was my first instinct as well. Seems like others have tried and failed. Isomorphic-git was by far the most polished library!
- TheRealPomax 6y agono-compile bundling comes to mind. Also, there is no "git executable" available in the browser, which is where this library shines (e.g. online IDEs that sync/share using github or gitlab repos)
- dheera 6y agoGiven the wealth of browser-based coding tools available today it's only a matter of time before you can actually be productive as a dev on a Chromebook or arbitrary machine with a web browser and nothing installed locally. Git is an obvious missing gaping hole in that ecosystem.
- smarx007 6y agoLittle benefit for Node, deal-breaker for browsers.
- yaseer 6y agoThis is pretty awesome. Browser-based coding environments are becoming huge (an observation, not a suggestion of what should be). This is a natural fit for those environments.
- nannal 6y agoAtom and vscode are both electron anyway, the progression to just doing it in the browser makes some sense
- freeqaz 6y agoWe actually use this library to provide the ability to "one-click" share projects in Refinery. It works really well (except in Incognito)! If you go to this[0] link, you'll see a bunch of nodes in a graph. Each one represents an AWS Lambda that will be deployed (and an API endpoint). The edges between are "microservice" calls between Lambdas that get configured with the deploy too. That's all coming from a Git repo here[1]. And if you edit the project by adding more blocks, it will actually push a commit to Git (if you're signed up and auth'd GitHub). Each block is just a folder, and the "project" is a YAML file. We have a bi-directional "compiler" that lifts/drops the project in either direction. This library made it super easy to ship this. We tried using the server first and it was a huge pain. We just had to setup a GitHub proxy to make this work. It's stateless now (your browser does the work) :) 0: https://app.refinery.io/import?q=pq4rsai019bm https://app.refinery.io/import?q=pq4rsai019bm 1: https://github.com/freeqaz/gensim-refinery https://github.com/freeqaz/gensim-refinery
- kasbah 6y agoVery interesting, do you have any more details about how this works? Does a user effectively `git push` to your Github proxy from the browser?
- freeqaz 6y agoYeah, exactly. The proxy is a part of Isomorphic-git. You're basically just using git via HTTPS. The proxy just injects the GitHub oauth token into the request (and handles the CORS problem of GitHub).
- jonnytran 6y agoFeature request: Can you please add support for `git log -- path/to/file` that isn't slow as hell? Thank you.
- WanderPanda 6y agoCould be interesting in combination with jupyter noteboos
- dang 6y agoDiscussed earlier this year: https://news.ycombinator.com/item?id=22420231 https://news.ycombinator.com/item?id=22420231 Also 2018: https://news.ycombinator.com/item?id=17083807 https://news.ycombinator.com/item?id=17083807