4 ms·
I can see how having git in javascript makes workflows with git in js based tools like webpack and rollup much more convenient to install and share. I'm having
by DrScientist 7y ago
I can see how having git in javascript makes workflows with git in js based tools like webpack and rollup much more convenient to install and share.
I'm having a failure of imagination on the browser side though - anybody got killer use cases running git in the browser?
- tomashubelbauer 7y agoI am personally using Isomorphic Git exclusively in my automation scripts (written in Node) where it is about infinity times more convenient than shelling out to Git and parsing its output (something which feels dirty to me even in scenarios where it works, like in VS Code's version control pane which does this), however I know a few folks are looking at online IDEs and various things with P2P - like using WebRTC to mesh up clients and using Git in a truly distributed fashion across this WebRTC mesh. The fact that you can supply your own fs implementation makes these kind of applications really easy.
- mattdesl 7y agoAn example would be Glitch or Codepen creating commits on each code change, to allow undo/redo of a project over a broader range of time. Glitch already has this feature although it’s currently a bit buggy. It may even be based on isomorphic git, not sure.
- mattdesl 7y agoFurther - I am using git commits to store hashes for code-created artworks, so that I can reproduce and remix the exported PNG at a later point. See here: https://github.com/mattdesl/canvas-sketch/blob/master/docs/exporting-artwork.md#git-commit--file-hashing https://github.com/mattdesl/canvas-sketch/blob/master/docs/e... Client side git would mean one less reliance on nodejs.
- Normal_gaussian 7y agogit backed personal wiki sites exist, though I don't know what they generally use. e.g. TiddlyWiki
- kossae 7y agoI'm wondering if I can use this in an ERP system I'm developing. A feature request has been to see a diff history of actions on an entity (say, Purchase Orders). Using something like this, I believe I could make a 'commit' on each save, then display a history of commits to the user to 'diff' against to see previous revisions (who added which items, when did the PO number change, etc). I was planning on storing this history in the database as raw JSON, then diffing the JSON server-side, but this may provide a more robust solution.
- vimslayer 7y agoThat could work, but note that there are other libraries that are purpose-built to do diffing without the rest of git's many features. We are using jsondiffpatch [1] and quite happy with it. It also has builtin formatters to output e.g. html view of the changes. [1] : https://github.com/benjamine/jsondiffpatch/blob/master/README.md https://github.com/benjamine/jsondiffpatch/blob/master/READM...
- kossae 7y agoOh that is sweet! Thanks for the tip!
- jmiskovic 7y agoLet say you are building a document editor web app, or any app for creating content. Instead of simple undo/redo you could leverage git powers for versioning + tagging + branching + collaboration on document content. I needed this kind of functionality on one project, but I haven't yet looked into isomorphic-git to see if it is actually a good fit for such purpose.
- bhl 7y agoPretty much this. I’m building a WYSIWYG note taking app that syncs with GitHub, sort of like Prose.io but more focused on the note taking than CMS part (although the option of publishing notes would combine these two). I think there’s two benefits of isomorphic git for this use case. 1. It’s more api agnostic: if I wanted to support Gitlab, I wouldn’t have to write substantially more code tailored specifically for Gitlab’s API because it speaks git. You would only have to switch out Github's auth for Gitlab's auth. I also found that add multiple files and versioning them with Github’s API is a pain; they’re remaking a client called Octokit but it’s pretty underdeveloped right now. 2. Offline version control: you shouldn’t have to be online to take notes. With isomorphic git I can add and commit, and then push back to GitHub later when I have Internet. Fun fact: to get git to work on the browser, the author of isomorphic-git wrote a library to port NodeFS commands backed by IndexedDb. This means you can also have offline image drag-and-drop. There are some minor issues with isomorphic-git when I checked a month ago. - Largest one is only fast-forward merges are supported; not sure how to get around this one besides cloning the remote Github branch and maybe manually merging files. - Another one is a bug with git init followed by git add remote and git pull which leads to a reference error because no local commit has been made yet; you can imagine a user who immediately logs in with Github so you want to sync with a pre-existing repo. [1] https://github.com/isomorphic-git/lightning-fs https://github.com/isomorphic-git/lightning-fs
- DrScientist 7y agoOk - but isn't the hard part of collaborative authoring the conflict resolution not the storing of versions per se. Git has a merge mechanism, but it's not necessarily that user friendly? Isn't something like OT ( operational transforms ), or CDRT ( Commutative Replicated Data Type ) a better way to do this?
- bhl 7y agoFork-able web content (e.g. blog posts, class notes) is something I've been looking at, but you would still need to rely on an online service like Github or Gitlab.