If you run into troubles, got a suggestion, or issue, please e-mail editor@webtigerteam.com

# Source control

To prevent over-writing each others work when collaborating, it's common to use a source control management (SCM) system such as Git or Mercurial. SCM can however be complicated ...
But this editor makes it simple and convenient to use SCM. With full integrated support for Mercurial, and with the ability to use Git repositories.

Also see live collaborate editing

## How to clone a Git or Mercurial repository

1. Select "Clone/add Repo" in the menu.
2. Fill in the HTTP or Git Uniform Resource Locator (URL) for the repository (repo), and a folder path for where the files should be saved.
3. Click `Clone repository`

You can make the clone dialog show up automatically by appending ?repo=repourl to the url. Example: https//webide.se/?repo=git@github.com:Z3TA/2dgeometry.git
Useful for example showing others your code, and letting them clone the repo, and run the code!

## Creating a new software repository

There are many services that lets you host your Mercurial or Git code repository (repo) for free, and access it via Hypertext Transfer Protocol (HTTP) or Secure Shell (SSH). For example Bitbucket and Github.

Here's how you create a new repository on Github:

1. Login or signup
2. Click Start a Project
3. Fill in a repository name.
4. Click "Create repository"
5. Switch to SSH under Quick Setup and Copy the URL for the repo: git@github.com:yourName/nameOfRepo.git
6. Right click in the editor and select "Clone a repository"
7. Paste the repo URL into the repository field
8. Click on the `Copy SSH public key` button in the editor's clone widget
9. If you are asked to generate a new SSH key, click `Yes`
10. If a copy dialog-box comes up, click `Manually copy`. Then select all the text and click `Ctrl+C` to copy
11. Go to Github settings/SSH keys and click new key
12. Paste the SSH public key you just copied. It starts with ssh-rsa and has a bunch of random letters. Then click Add SSH key
13. Go to the editor's clone widget and click `Clone repository`

If you get an error message:

- Make sure you use the SSH git@github.com URL. Or try filling in your Github username and password.
- Make sure the "Clone into" field is a valid folder path.
- If it's a Git repository, make sure the repository URL ends with .git
- If it's still not working, right click in the editor and select "Terminal", and in the terminal type hg clone git@github.com:yourName/nameOfRepo.git
- If nothing works, please contact support

## Make a new commit

A commit is a set of changes ...
Edit any of the files in the repository, or add a new file ...

Then click `Alt+C` or right click in the editor and select "Commit" to show the commit widget.
If there are no "Commit" option in the menu, select "Version control" and then click `Commit`.

In the commit widget select the file(s) to the left, then write a comment int the box to the right. It's useful to write why you made the changes, so that you or your colleges can go back and se why the change(s) was made.
Then click Commit & Push to both make the commit and push the change to the repository.

If you are an "expert" you can write hg commit -m "why the change(s)" in the Termial. And then write hg push

## Pull new changes

It's a good idea to often pull in changes from the repository. Maybe you made some updates on another editor/computer, or maybe your colleges have pushed updates to the repository.

Right click in the editor and select "Version control". In the version control widget click `Pull & Update` to both pull and update/merge. Hopefully it will be all good and no merge conflicts occurred. If a merge conflict occured, the editor will guide you through the merge process.
Clicking only "pull" will just download the updates, while "Update" actually updates the files.

If you are an "expert" you can write hg pull && hg update in the Terminal

- ⬅Go back
- ⬆Index