Ok, so assuming you have your project in a local git repo, here’s what you’ll need to do:
- Retrieve your project’s git repo url and your git token from the project’s advanced options menu. Here’s what that looks like:
- in your local repo add your project’s repo as a remote:
git remote add origin https://{{put your git token here}}:@{{put your git url here}}
. That’s using basic authentication with an empty password and your project’s repo url, so an example with a spoofed token might look likehttps://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:@api.glitch.com/anonymous-anaconda/git
. This allows you to authenticate to your project’s repo so you can push.- if you cloned the repo you’ll already have an
origin
remote. In that case you want this command:git remote set-url origin https://{{put your git token here}}:@{{put your git url here}}
- if you cloned the repo you’ll already have an
- As I noted above by default your project has the
master
branch checked out, so assuming you haven’t changed that you won’t be able to push tomaster
- git will report an error if you do. So you need to move the code you want to push to a new branch before you can push it. In your local repo:git checkout -b my-new-branch
- Now you have something you can push. Assuming you’ve never pushed this branch before in your local repo:
git push --set-upstream origin my-new-branch
- To get your new code live, in your project’s console:
git merge my-new-branch
. If you want to verify what you’re going to merge you can usegit diff ..my-new-branch
first. -
refresh
in your project’s console to update the editor with the new changes.
Once you’ve got things set up you can just repeat steps 4-6 for all your local changes, except for step 4 you’ll want git push origin my-new-branch
(you’ve already set up that branch to track the remote’s branch, so you don’t need --set-upstream
. If you’re making changes in both places it’s a little more complicated because you’ll need to pull those changes down to get them locally:
git pull origin master
git merge master my-new-branch
will update my-new-branch
with the changes in your project’s repo.
EDIT: updated image