I’m not sure if this should be a new topic by now (as opposed to necro’ing this 4-year-old one) but I wanted to renew my pitch for improving the workflow when GitHub is where the master copy of the code lives.
I think the Glitch Powers That Be have long had Grand Plans for doing this the Right Way using the Power Of Git but I think the following adjustment to the import/export functionality could make a night-and-day difference in removing a barrier to developing in Glitch when some of your collaborators are committing directly to GitHub.
To review, I believe that currently it’s just too fraught. In order to be sure I don’t lose work or create a huge mess to be untangled with major git fu, I have to make sure that that any collaborator on Glitch periodically exports their changes to GitHub (so far so fine) and also imports from GitHub occasionally to get the latest changes. This part is not fine. I have to first export from Glitch to GitHub, merge the PR, then immediately import from GitHub to Glitch. If any edits happen in between, they’ll be lost. Plus I don’t trust myself to conscientiously follow that export-merge-import sequence every time.
That workflow means too much apprehension about using Glitch!
Actual Proposal
Make the import-from-GitHub button also automatically and atomically do an export-to-GitHub first.
Imagine: I’m hacking away in Glitch, I want to grab the latest from GitHub, I click import, and boom. I’ve got the latest. What’s that? I forgot to merge in my own changes first and everything I was working on is gone and I have to find some git wizard to go back in time for me? Au contraire! Everything I did is waiting on GitHub as a new PR. I can go merge it and then do another import-from-GitHub and I’m back in business.
The only question is how to title that PR so that it’s clear why it got created and so that I understand that if I did intentionally blow away what I had in Glitch, overwriting it with the latest in GitHub, then I can go ahead and delete that PR as well.
Maybe something like “Automatic PR from Glitch before overwriting via Glitch’s import-from-GitHub feature. Delete me if that overwriting was intentional!”.
Possibly More Principled Proposal
I can imagine a fair objection that the above proposal is too magical – that each button should do exactly what it says and nothing more. If so, here’s a more radical and opinionated proposal: Kill both the import and export buttons and replace them with a single “sync with GitHub” button that does an export-followed-immediately-by-import.
Now the workflow for importing is the same as ever. You hit “sync” and you’ve got the latest from GitHub like normal. The workflow for exporting is more annoying but, crucially, impossible to screw up. You hit “sync” and temporarily lose all your work in Glitch. You have to go merge Glitch’s PR and sync again to be back where you left off on Glitch. You’d want a warning like so:
Syncing with GitHub sends your current updates on Glitch to GitHub as a PR and then overwrites your Glitch project with the latest from GitHub. To get the latest from both, you need to merge the PR on GitHub and then hit this sync button again!
Simplest Proposal
A variant that would likely be the least work and least consternating to existing users would be to add a third button. (I know “just add one more button” is rarely the best answer.) The import button would overwrite what’s in Glitch like normal, the export button would create the PR in GitHub like normal, and a new “sync” button would just do both – create the PR and then blow away what’s in Glitch in favor of GitHub.
Then just make the “import” button red (for danger) and I think everyone would feel safe.