GIT Guide
GIT is one of the main ways of exporting projects from the editor. GIT support is available for popular GIT hosting (i.e. Github, Gitlab, Bitbucket).
- Cloning a Repo
- Init a Repo Locally
- Connecting a Local Repo to a Remote
- Pushing Repo to Remote
- Check Out Branch
- Creating a Branch
- Switching Branches
- Pushing a Local Branch to Remote
- Deleting a Branch
- Merge Conflicts
- Viewing Diffs
Cloning a Repo
Public Repo
Cloning a public repo does not require any credentials.
-
Open the Clone Repo dialog. Click the ⑂ button on the Projects tab.
-
Enter the Repo URL (i.e.
https://github.com/arturkot/the-house-game.git
) -
Shallow: Toggle between a deep clone and a shallow clone. A deep clone will clone the entire repository history. A shallow clone will only clone the HEAD commit.
-
Click OK and the cloning should begin. You can access your cloned project from the Project menu tab.
Private Repo
To clone a private repo, you need to set up GIT credentials first. See Creating an App Token page for more details.
Local Repo
Turn a local project (no remote repo in Github, Gitlab, etc.) for keeping track of history and gain access to git features like diffing, reverting, commiting, etc.
- Create a project. See Creating a Project for more details.
-
Click the + Icon to initialize a local repository.
Connecting a Local Repo to a Remote
To connect a local repostiory to a remote one (BitBucket/Gitlab/Github), follow the steps below. Connecting to a remote repository allows backing up and sharing your work with others that have access to that repository.
-
Create a new repository with a remote provider (i.e. Github) If you already have an empty repository created, then skip this step.
Example with Github
a. Go to Create Repo) page. Enter a repository name.
b. Select if the repo will be public or private. For private repo you would need to create an app token to access it. See Creating an App Token for more details.
c. DO NOT initialize the repository with a README as this will create a first commit that will be different from your local repository. The repo must be empty to not have any conflicts with the local one. Click Create repository button.
d. Save the HTTPS remote repository URL for your remote. You will need this later.
-
Create an initial commit for your repo. If your local repo already has commits, then skip this step.
-
Create your Remote in your project that links to your Remote Repo URL created in step 1.
-
You can now push your commits to your remote repository. See the next section for details on how to do this.
Pushing Repo to Remote
If you want to sync your commits to your remote repository, you can do so pushing the Push feature. To push commits to your remote, follow the steps below:
-
You need to have created an app token to push. You must be the owner of the public repo to push to public repos. To create an app token please see Creating an App Token page.
-
Open the GIT menu on the Files menu tab, and Click Push to push any unpushed commits.
Authentication Error
If you get an authentication error message the token that you created is not valid for the repo that you are pushing to. Check that the provider is set correctly for the token, and that your token has the proper repository access permissions. See Creating an App Token page for more details.
Check Out Branch
Branches are a great way to keep separate versions of your code base separate. To checkout a different branch, access the checkout option from the GIT menu.
Creating a Branch
You can use the + Button in the Branches modal to create a new branch. See the following example below on creating a local branch.
Switching Branches
To switch branches, follow the steps below:
-
Open Branches modal to see a list of branches.
-
Click the Checkout button to checkout either a Local or Remote branch.
Pushing a Local Branch to Remote
- Create a local branch. See instructions in Creating a Branch.
- Checkout the local branch.
- Set up a remote to push to. See instructions in Connecting a Local Repo to a Remote.
- Push the local branch to the remote. See instructions in Pushing Repo to Remote.
Deleting a Branch
You can delete local branches but not remote branches. Remote branch deleting will be supported in the future. To delete a branch click on the "Trash" icon in Branches modal. You cannot delete the current active branch, so be sure to switch to another branch to before deleting the current branch.
Merge Conflicts
Sometimes a file have a discrepancy with the remote repository, and the history cannot differentiate which one is newer. As a result, the file is marked as having a "Merge Conflict". These files will be marked in purple.
Projects with merge conflicts cannot push commits to the remote repository until all merge conflicts are resolved.
Currently the only way to resolve merge conflicts is to manually mark them as resolved by right-clicking on the file and selecting the "Mark Resolved" option.
File Diffs
Sometimes you need to see changes between your local repository and the remote repository; this is when a diff viewer is needed. Spck Editor has a built-in diff viewer for files that have changed from the remote repo.
Viewing Diffs
To view changes that have occurred, select a file marked in yellow or blue depending on if the editor is in "dark" or "light" mode.
You can open the diff by clicking on the filename in the Source Control section of the file menu tab. You can also open the diff by from the Options menu in the Files section and selecting the View Diff option.