
Isomorphic-git v1.0 - kjhughes
https://isomorphic-git.org/blog/2020/02/25/version-1-0-0
======
Sammi
Using this and Gitlab and Netlify you can make static pages that can edit
themselves without having a backend anywhere. That is the holy grail of
dynamic static. Or Naught Static Pages as I call them :)

I'm not talking about making use of some "serverless" backend like Firebase or
something. I'm talking about only using git hosting and static website hosting
and in browser computation to make "dynamic" websites.

What you do is:

* You make a regular static page with whatever static web page framework or view template software you like that runs in the browser. I got Handlebars to work. (I'm looking at trying Choo next, because it is literally one hundredth of the size)

* Make another "admin" page where the user can input the data. This page first checks out the current git repo.

* When the user hits submit you use the newly edited data to build the static site in the browser and commit/push everything to git where it is automatically pushed to netlify.

You first have to bootstrap this process on your own machine in the first
commit.

I've been holding on to this secret for over a year. Well the cats out of the
bag now. I haven't run into someone doing something similar with Isomorphic-
git yet. I've had it in production for an artist website for almost a year. I
don't know if this is good or bad for Gitlabs or Netlifys business model.

~~~
tln
Netlify-cms does this, not sure whether it uses isomorphic-git but client side
code talks directly to GitHub.

The admin experience leaves a lot to be desired... Slow previews (requires a
full build - like a minute!), slow saving, buggy.

Fixing the first two requires a different architecture

~~~
Sammi
It looks like Netlify-cms runs the git and static website software on Netlify
backends. So you're not getting the freedom to do whatever you want in the
frontend like you do with my approach where the static site generation and git
handling happens in the browser. With Netlify-cms you are tied to their
implementation of these things on their backend servers.

~~~
tln
You can configure netlify-cms to go through netlify for the git operations or
not. Going through netlify servers let users edit without github credentials.

On the blog where I have set this up, it goes direct and content editors
aren't that happy with the experience

Doing static site generation in the browser would definitely help with
previews, at the cost of not working with off-the-shelf static site
generators.

------
mstade
I wonder how this compares to wasm-git[1], which is libgit2 compiled to wasm
for use in both the browser and node. At face value it seems isomorphic-git
has been around for longer, and wasm-git seems hot off the press, but the
latter seems like maybe it's got more eyes on the prize given libgit2's
developer base?

(I have no affiliation with either project, just looking for options to use
git in-browser and in node.)

[1]: [https://github.com/petersalomonsen/wasm-
git](https://github.com/petersalomonsen/wasm-git)

~~~
bhl
There was a discussion about this two years ago:
[https://github.com/isomorphic-git/isomorphic-
git/issues/268](https://github.com/isomorphic-git/isomorphic-git/issues/268).

~~~
mstade
Great link, answered all my questions – thank you!

------
isomorphic
I'd like to comment on the name of this project, but fear my comment would be
equivalent to an argument about semantics.

~~~
aidos
The term has been weirdly adopted by the dev community in a way that kinda
makes sense if you squint a little but has always created a dissonance in my
brain due to my maths background.

But since we’re here! For those who don’t know the word from outside of the
dev sphere, in maths it refers to having 2 way mappings between 2 structures.
You can do it between totally seemingly unrelated parts of maths (you just
need to show how to map between them). As a result, anything you’ve proved in
one space holds true in the other. It can be useful if you have an intuition
and understanding of one of the spaces but not the other.

I’m trying to think of a nice example but I haven’t thought about this type of
maths for a couple of decades now. Answers on a postcard please!

~~~
OJFord
> The term has been weirdly adopted by the dev community in a way that kinda
> makes sense if you squint a little but has always created a dissonance in my
> brain due to my maths background.

I don't really have a 'math background' (engineering graduate, but I don't
think that counts, a mathematician certainly wouldn't) but I know (enough,
roughly, layman's definition) what it means in mathematics, and work in
software engineering.

I have absolutely no idea why this project is called 'isomorphic', it doesn't
make any sense to me however much I squint, and doesn't seem to be explained
anywhere.

I'd guess it's just an arbitrary name and isn't supposed to have meaning?
Though it's a library for `git`, why not just call it `git`? _shrugs_

~~~
CGamesPlay
The “isomorphic” comes in because the same library / API is available in both
the browser and in node. So “anything you can prove in [node] is also proved
in [the browser]” (in the context of this library).

~~~
cpr
I think more generally it's used to denote code that runs the same on browser
and back-end.

~~~
Isamu
"Same" just isn't as fun as saying "Isomorphic"

------
dang
A thread from 2018:
[https://news.ycombinator.com/item?id=17083807](https://news.ycombinator.com/item?id=17083807)

~~~
mxcrossb
It’s fun to see everyone in 2018 was arguing about Rust too

------
DrScientist
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?

~~~
jmiskovic
Let 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.

~~~
DrScientist
Ok - 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?

~~~
jmiskovic
Conflict resolution of course depends on actual content. Source code could be
among most tricky ones to auto-resolve or detect when manual merge is
necessary. Documentation, art and other not-so-strict content could be more
auto-resolvable than source code. Git is here simply a mechanism for allowing
different work flows. Your web app should enforce best practices for non-
expert users. The added benefit is developer familiarity with git concepts.

I wasn't familiar with OT and CDRT, so maybe I'm off the mark. They seem to
try to solve real-time collaboration between multiple users editing same part
of same document. This would always require some meta-document or meta-channel
where users coordinate what should be changed, in what way and who does what.
I would argue that git model is better: user decides when to pull and when to
push changes, and the communication between collaborators is outside the scope
of the versioning system.

Collaboration is just one application. Even single-user content creation could
vastly benefit from built-in versioning. This would eliminate some mental
burden and usage friction (tagging), and open up more possibilities to
experiment with different directions (branching). The feeling you get when you
check-in working version of your code and you are now free to break stuff,
that kind of feeling is missing when creating slides, graphics, music, CAD
design...

------
joshfarrant
I’d love to see some work put in to making this work with React Native. I
spent a day trying to get this to work a few weeks ago with no joy, and I
couldn’t find any indication that anyone else had managed to make it work
either.

~~~
akdor1154
But why? Aren't your users gonna be far better off if you used native git?

Sorry, I know this comes off as a bit dickish, but I'm interested to know the
circumstances that lead to this point of view :)

~~~
joshfarrant
My particular use-case is that I'm not a Swift/Objective-C developer, I'm a
JavaScript developer.

React Native opened the door to allow me to build apps and, realistically, I'm
not going to spend the time battling through trying to get native git working
through React Native. If there's a native developer out there that wants to
tackle this problem and wrap it up in a nice JS module then I'd be in your
debt!

------
grizzles
Great library. Wish it worked with local urls tho.

------
pyramation
I love this library! ;)

------
nathias
please devs stop using big words you don't understand

