Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Integrating Git with the Scratch editor
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Oops, fixed(#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!!
Last edited by ajskateboarder (May 21, 2024 01:56:29)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Some fixes
- Translations now correctly reload on dialogs when changing language
- Using an online repository has been made completely optional
- A username and email can be set when creating a new project, no need to use “git config”
- Translations now correctly reload on dialogs when changing language
- Using an online repository has been made completely optional
- A username and email can be set when creating a new project, no need to use “git config”
- dynamicsofscratch
-
1000+ posts
Integrating Git with the Scratch editor
(#79)okayy! will translate to hindi and gujarati sooner than laterFork 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!!
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
I found a really silly hack that lets me remove the need to open a project twice to set it up
TurboWarp uses the Filesystem API to open projects if available, but falls back to using regular inputs if it doesn't exist. Knowing this, I can basically do the following:
TurboWarp uses the Filesystem API to open projects if available, but falls back to using regular inputs if it doesn't exist. Knowing this, I can basically do the following:
const tmp = window.showSaveFilePicker; window.showSaveFilePicker = undefined; fileMenu.openProject(); // this is part of an internal api setTimeout(() => { document.querySelectorAll("input[type=file]")[2].onchange = ({target}) => { console.log(target.files[0].path); // submit this to the websocket server } }, 100); window.showSaveFilePicker = tmp;
Last edited by ajskateboarder (May 23, 2024 14:59:44)
- dynamicsofscratch
-
1000+ posts
Integrating Git with the Scratch editor
(#84)Janky Solutions and Sons Pvt. Ltd.
I found a really silly hack that lets me remove the need to open a project twice to set it up
TurboWarp uses the Filesystem API to open projects if available, but falls back to using regular inputs if it doesn't exist. Knowing this, I can basically do the following:const tmp = window.showSaveFilePicker; window.showSaveFilePicker = undefined; fileMenu.openProject(); // this is part of an internal api setTimeout(() => { document.querySelectorAll("input[type=file]")[2].onchange = ({target}) => { console.log(target.files[0].path); // submit this to the websocket server } }, 100); window.showSaveFilePicker = tmp;
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Do you have any error logs in the console or server? Did you install the latest Git? It isn't working for me
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Fixed issues with the latest version of TurboWarp Desktop 1.12.3
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
I made a small viewer for projects made with scratch.git here: https://ajskateboarder.github.io/scratch-git You will still need to install scratch.git to make commits, of course. I found TurboWarp Scaffolding for this - very cool library that lets you configure basically much of the Scratch VM to run projects 

(this never worked) I found a really silly hack that lets me remove the need to open a project twice to set it up
Last edited by ajskateboarder (June 5, 2024 17:24:40)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Updates:
- You can now clone from and make commits to any public repository and push commits upstream if you have authenticated

- The application does much better error handling overall and basically never panics
- Committing to a non-configured project that has a similar name to an existing project will warn you instead of silently failing
- Logo and thumbnail were polished
- By the time you read this, I probably also patched an issue where repos with a completely unrelated “master” branch will pull into the default branch, which is usually “main” on sites like GitHub, wreaking absolute havoc
- You can now clone from and make commits to any public repository and push commits upstream if you have authenticated

- The application does much better error handling overall and basically never panics
- Committing to a non-configured project that has a similar name to an existing project will warn you instead of silently failing
- Logo and thumbnail were polished
- By the time you read this, I probably also patched an issue where repos with a completely unrelated “master” branch will pull into the default branch, which is usually “main” on sites like GitHub, wreaking absolute havoc
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Pushing to repos that use usernames/passwords is now officially supported (technically it always was, but it was a bit more confusing). You should receive an alert saying to enter your username and password in the prompts shown by the git CLI. This will not be implemented on the GUI because of security reasons and possible phishing concerns
Last edited by ajskateboarder (June 26, 2024 19:25:48)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Fixed a bug that prevented commits from going through: https://github.com/ajskateboarder/scratch-git/issues/27
Please test
Please test
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Many updates:
* Costume and asset diffs
https://u.cubeupload.com/ajskateboarder/58548530583954.png
https://u.cubeupload.com/ajskateboarder/548380594.png
* Use attached comment label for script changes
https://u.cubeupload.com/ajskateboarder/Screenshotfrom202407.png
https://u.cubeupload.com/ajskateboarder/ed2Screenshotfrom202407.png
(changes should also be searchable)
* Settings menu
* Uninstalling
* Commit modal revamp
* better commit caching
* pagination status (n to n commits out of total commits, n commits out of total when searching)
* Block and reporter menu changes work in diffs
* Switching themes won't trigger old highlights
* Commit button in the Git menu shows the number of commits ahead compared to upstream (if you have an upstream obviously)
* Detaching blocks has correct diff behavior
* Pulling from upstream is no longer hardcoded to use master, uses HEAD branch instead
* An FAQ (which may never be updated): https://ajskateboarder.github.io/scratch-git/faq.html
Test the release here: https://github.com/ajskateboarder/scratch-git/releases/tag/0.0.80
* Costume and asset diffs
https://u.cubeupload.com/ajskateboarder/58548530583954.png
https://u.cubeupload.com/ajskateboarder/548380594.png
* Use attached comment label for script changes
https://u.cubeupload.com/ajskateboarder/Screenshotfrom202407.png
https://u.cubeupload.com/ajskateboarder/ed2Screenshotfrom202407.png
(changes should also be searchable)
* Settings menu
* Uninstalling
* Commit modal revamp
* better commit caching
* pagination status (n to n commits out of total commits, n commits out of total when searching)
* Block and reporter menu changes work in diffs
* Switching themes won't trigger old highlights
* Commit button in the Git menu shows the number of commits ahead compared to upstream (if you have an upstream obviously)
* Detaching blocks has correct diff behavior
* Pulling from upstream is no longer hardcoded to use master, uses HEAD branch instead
* An FAQ (which may never be updated): https://ajskateboarder.github.io/scratch-git/faq.html
Test the release here: https://github.com/ajskateboarder/scratch-git/releases/tag/0.0.80
Last edited by ajskateboarder (July 8, 2024 21:46:59)
- breakfast_for_dinner
-
1000+ posts
Integrating Git with the Scratch editor
sounds incredible!!!! i'll try this out tomorrow when i'm on a computer 

- dumorando
-
100+ posts
Integrating Git with the Scratch editor
would this be possible to integrate in a browser version of turbowarp? i dont really know how scratchgit works but it seems like you can take the userscript or whatever you put in the desktop app and put it in turbowarp.org
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Great question, I have thought about this before. The userscript would be possible to integrate, but it still relies on a backend to manage Git projects locally, so that would have to be turned into a centralized server which would probably be a privacy and scaling headache would this be possible to integrate in a browser version of turbowarp? i dont really know how scratchgit works but it seems like you can take the userscript or whatever you put in the desktop app and put it in turbowarp.org
Last edited by ajskateboarder (July 9, 2024 19:44:56)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Here's what split and unified diffs will look like for costumes sooner or later (bright green indicates additions, red indicates removals, and a milder green indicates unchanged areas) (i know its a bit hard to see additions
)





Last edited by ajskateboarder (July 20, 2024 23:22:01)
- TheSecondGilbert
-
100+ posts
Integrating Git with the Scratch editor
Use grey for the unchanged parts. This way you only need to see the colors… Here's what split and unified diffs will look like for costumes sooner or later (bright green indicates additions, red indicates removals, and a milder green indicates unchanged areas) (i know its a bit hard to see additions)
…oh yeah, I forgot about color-blind people. Oops.
Last edited by TheSecondGilbert (July 21, 2024 10:53:59)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
I would try this but I'm not really sure how to do it.. the images are tinted red and green, made semi-transparent, and overlapped on a canvas Use grey for the unchanged parts. This way you only need to see the colors…
Last edited by ajskateboarder (July 21, 2024 14:24:54)
- ajskateboarder
-
1000+ posts
Integrating Git with the Scratch editor
Pro tip: don't introduce a lot of features in one fell swoop
0.0.90!!!!
- A UI to restore scripts. This is a fun one, and it borrows some stuff from VSCode's Git UI and simplifies it a bit.
Basically, if you change a lot of scripts in a sprite, you might want to combine older versions of scripts and newer ones to see how they work. With this feature, you can open your sprite's changes, click “Restore scripts”, and toggle scripts between the version before (↩) and after (↪) you changed it. After that, it creates a sprite which combines the versions of scripts you want
(this will also include restoring unchanged scripts in the future)
- Costume “diffs” should also be available and pretty stable (it might take a few tries to get them working). It should look like #97. I also downscaled diffed images so you don't have to scroll so much
- When you delete a sprite, you can view the old sprite after you save
- There's a good settings panel now
- Localization for German (mybearworld) and Spanish (josueart) have been removed temporarily until scratch.git is feature complete
- The main UI finally moved away from using HTML dialogs for everything and now uses Scratch tutorial cards (to match with TurboWarp's debugger) and Scratch's modals (to match the rest of Scratch's settings). No more weird close buttons ig. The welcome screen will still be a regular dialog though
0.0.90!!!!
- A UI to restore scripts. This is a fun one, and it borrows some stuff from VSCode's Git UI and simplifies it a bit.
Basically, if you change a lot of scripts in a sprite, you might want to combine older versions of scripts and newer ones to see how they work. With this feature, you can open your sprite's changes, click “Restore scripts”, and toggle scripts between the version before (↩) and after (↪) you changed it. After that, it creates a sprite which combines the versions of scripts you want
(this will also include restoring unchanged scripts in the future)
- Costume “diffs” should also be available and pretty stable (it might take a few tries to get them working). It should look like #97. I also downscaled diffed images so you don't have to scroll so much

- When you delete a sprite, you can view the old sprite after you save
- There's a good settings panel now
- Localization for German (mybearworld) and Spanish (josueart) have been removed temporarily until scratch.git is feature complete
- The main UI finally moved away from using HTML dialogs for everything and now uses Scratch tutorial cards (to match with TurboWarp's debugger) and Scratch's modals (to match the rest of Scratch's settings). No more weird close buttons ig. The welcome screen will still be a regular dialog though
- Discussion Forums
- » Advanced Topics
-
» Integrating Git with the Scratch editor