Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Integrating Git with the Scratch editor
- dynamicsofscratch
-
1000+ posts
Integrating Git with the Scratch editor
(#59)that's be really coolziessomeone should host a gitea for this and then @ajskateboarder could intergrate it Time to implement setting repo remotes so you can push your stuff online!!! (I'm not hosting a Scratch-friendly Git platform
- Mr_rudy
-
100+ posts
Integrating Git with the Scratch editor
hold on im trying to do it right now, ill update you when its done(#59)that's be really coolziessomeone should host a gitea for this and then @ajskateboarder could intergrate it Time to implement setting repo remotes so you can push your stuff online!!! (I'm not hosting a Scratch-friendly Git platform
won't be self hosted + will barely have any storage but will still be cool
- Mr_rudy
-
100+ posts
Integrating Git with the Scratch editor
ok i did it https://scratchgit.glitch.me/ also i made forum post https://scratch.mit.edu/discuss/topic/756111/?page=1#post-7933628hold on im trying to do it right now, ill update you when its done(#59)that's be really coolziessomeone should host a gitea for this and then @ajskateboarder could intergrate it Time to implement setting repo remotes so you can push your stuff online!!! (I'm not hosting a Scratch-friendly Git platform
won't be self hosted + will barely have any storage but will still be cool
Last edited by Mr_rudy (April 21, 2024 19:43:26)
- Steve0Greatness
-
1000+ posts
Integrating Git with the Scratch editor
So basically: don't use it for production. won't be self hosted + will barely have any storage but will still be cool
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Thanks to Steve0Greatness for uncovering bugs on Windows which are now fixed:
- Popup windows not fully closing
- Windows paths not working when making a new Git project
Also, scripts that are changed are now highlighted on save. This should make it easier to identify what was changed:

(pretend you see me clicking the Save button in the top right corner)
- Popup windows not fully closing
- Windows paths not working when making a new Git project
Also, scripts that are changed are now highlighted on save. This should make it easier to identify what was changed:

(pretend you see me clicking the Save button in the top right corner)
- davidtheplatform
-
500+ posts
Integrating Git with the Scratch editor
You could outline blocks in red/green if they are removed/added
IMO this is still better than crossing out blocks (also it seems highlighting blocks is possible?) Thanks to Steve0Greatness for uncovering bugs on Windows which are now fixed:
- Popup windows not fully closing
- Windows paths not working when making a new Git project
Also, scripts that are changed are now highlighted on save. This should make it easier to identify what was changed:
(pretend you see me clicking the Save button in the top right corner)
- dynamicsofscratch
-
1000+ posts
Integrating Git with the Scratch editor
(#64)yeah… large scale projects, be aware lol.So basically: don't use it for production. won't be self hosted + will barely have any storage but will still be cool
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
The feature mentioned on post 65 is now, for the most part, functional (try it out on release 0.0.52). Additionally, a few things have changed:
- Ctrl+S is now the hotkey to display changes (Ctrl+Shift+S can be used to save without displaying, but the changes will be remembered the next time you use Ctrl+S). I'm not sure if MacOS lets you use Command+S though (if anyone could test…
)
- JSX was removed entirely from the project since it made the build process much more annoying and it for some reason didn't let me apply inline styles (I didn't migrate everything to JSX anyways)
- Ctrl+S is now the hotkey to display changes (Ctrl+Shift+S can be used to save without displaying, but the changes will be remembered the next time you use Ctrl+S). I'm not sure if MacOS lets you use Command+S though (if anyone could test…

- JSX was removed entirely from the project since it made the build process much more annoying and it for some reason didn't let me apply inline styles (I didn't migrate everything to JSX anyways)
Last edited by ajskateboarder (April 22, 2024 23:35:02)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
v0.0.55
- Diffed scripts can now be jumped to in the editor (the editor will “teleport” to the script and flash it a few times, just like TurboWarp's find block feature)

- Scripts with empty if statements can now be viewed correctly without errors
- Block diffs now have expanded context, which also avoids cases where scratchblocks creates these “end” blocks (I have plans to make this configurable)
- Settings to configure highlights and plain text on diffs are now bound to localStorage (meaning your settings will be remembered)
- The “Don't show again” checkbox on the welcome dialog has been removed (it was useless)
- The close button for the diff dialog has been relocated to the the top of the modal
- The CSS for active tabs has been fixed
- Diffed scripts can now be jumped to in the editor (the editor will “teleport” to the script and flash it a few times, just like TurboWarp's find block feature)

- Scripts with empty if statements can now be viewed correctly without errors
- Block diffs now have expanded context, which also avoids cases where scratchblocks creates these “end” blocks (I have plans to make this configurable)
- Settings to configure highlights and plain text on diffs are now bound to localStorage (meaning your settings will be remembered)
- The “Don't show again” checkbox on the welcome dialog has been removed (it was useless)
- The close button for the diff dialog has been relocated to the the top of the modal
- The CSS for active tabs has been fixed
Last edited by ajskateboarder (April 28, 2024 23:11:22)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Steve0Greatness is currently facing an issue with making commits. Is anyone else able to reproduce this?
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
making commits. Is anyone else able to reproduce this?Bump on this Steve0Greatness is currently facing an issue with
- There is now a copy button for diffed scripts in both image and text form
- A tiny regression-caused bug that failed to display removed scripts in diffs is now fixed
- A bug that caused unnecessary commits to be made (eg. “Sprite: +4, -4 blocks” when said Sprite wasn't modified at all) is now fixed
- A logo has been made

I'm also working on localization
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Pushing to any Git remote is almost done. Basically you enter settings here:

And hitting the Push button from the Git menu will send it off to the remote on the main branch. Authentication will likely be a simple process for remotes other than GitHub (like scratchgit.glitch.me) since they accept using a username and password to push to the repository, but GitHub requires either using a personal access token or authentication with an app.. the latter is probably the neater solution for GitHub tbh
edit: I figured out the pushing part, but I was reminded of pulling changes from upstream, so now I'm going to finish that
Essentially, when you pull from upstream, it should update the repo JSON as well as the actual project you opened in the editor (done!!! –rebase is very cool)
note: GitHub authentication will require a small server rewrite since the server has been written to follow a request-response layout like HTTP, but GitHub auth would require sending two messages (one for device code and another for auth success)

And hitting the Push button from the Git menu will send it off to the remote on the main branch. Authentication will likely be a simple process for remotes other than GitHub (like scratchgit.glitch.me) since they accept using a username and password to push to the repository, but GitHub requires either using a personal access token or authentication with an app.. the latter is probably the neater solution for GitHub tbh
edit: I figured out the pushing part, but I was reminded of pulling changes from upstream, so now I'm going to finish that

note: GitHub authentication will require a small server rewrite since the server has been written to follow a request-response layout like HTTP, but GitHub auth would require sending two messages (one for device code and another for auth success)
Last edited by ajskateboarder (May 17, 2024 15:46:26)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
removed
Last edited by ajskateboarder (May 15, 2024 23:45:45)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
- Pushing, pulling, and authentication for GitHub is supported. Make sure to install the GitHub app beforehand: https://github.com/apps/scratch-git-bot
- Localization is supported. Language PRs are welcome as of now, but note you'll have to send in PRs as more things are added. Thanks to mybearworld for German translations and josueart for Spanish translations!!
- Localization is supported. Language PRs are welcome as of now, but note you'll have to send in PRs as more things are added. Thanks to mybearworld for German translations and josueart for Spanish translations!!
- dynamicsofscratch
-
1000+ posts
Integrating Git with the Scratch editor
(#77)How to give translations?
- Pushing, pulling, and authentication for GitHub is supported. Make sure to install the GitHub app beforehand: https://github.com/apps/scratch-git-bot
- Localization is supported. Language PRs are welcome as of now, but note you'll have to send in PRs as more things are added. Thanks to mybearworld for German translations and josueart for Spanish translations!!
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Fork the repo, copy the en.json, change the file name to be some other locale, and translate stuff to that locale(#77)How to give translations?
- Pushing, pulling, and authentication for GitHub is supported. Make sure to install the GitHub app beforehand: https://github.com/apps/scratch-git-bot
- Localization is supported. Language PRs are welcome as of now, but note you'll have to send in PRs as more things are added. Thanks to mybearworld for German translations and josueart for Spanish translations!!
Last edited by ajskateboarder (May 20, 2024 10:19:50)
- errplane
-
58 posts
Integrating Git with the Scratch editor
(#77)“scratch.git bot is a private GitHub App.”
- Pushing, pulling, and authentication for GitHub is supported. Make sure to install the GitHub app beforehand: https://github.com/apps/scratch-git-bot
- Localization is supported. Language PRs are welcome as of now, but note you'll have to send in PRs as more things are added. Thanks to mybearworld for German translations and josueart for Spanish translations!!
- Discussion Forums
- » Advanced Topics
-
» Integrating Git with the Scratch editor