SCM (Source Control Management) is a great way of managing different versions of your projects and collaborating with others. I recommend you set up SCM on your computer for all your future projects.
In this tutorial, I’ll show you how you can set up Git GUI for source control with GameMaker projects.
This post will not be covering GameMaker’s internal SCM system (SVN).
Creating a Repository
Step 1 is to set up an account on either site. After you do so, you’ll be able to create repositories. So, you’ll need to create a repository called new-repo. Here’s how:
Go to the BitBucket homepage. Click on the + icon (Create), then select Repository.
Then fill in the repository name (new-repo) and select whether or not you want it to be private. Make sure the Version control system is Git.
When you click on Create repository, you’ll be greeted by an overview page. There, click on Create a README:
Your repository needs to have at least one file to be able to clone correctly, so you will have to create the readme. After you click on that button, you will have to Commit the text file that shows up.
Go to the GitHub homepage and click on New Repository to create one.
You should see this page next. Enter the repo name, and check the Initialize this repository with a README checkbox, so that it automatically adds a readme inside it. When you’re done, click on Create repository.
Download Git from here and install it.
After it’s done installing, open Git Bash and
type git gud type these commands (Enter your email & full name inside the quotes):
git config --global user.email "your_email"
git config --global user.name "FIRST_NAME LAST_NAME"
Enter both user.email & user.name if you’re using BitBucket. If you’re using GitHub, user.email is all you need to enter.
Now, you need to clone your repository (new-repo) to your computer. You will need to do this every time you create a repository, to download it to your computer and establish a connection to the repo on GitHub/BitBucket.
Open the folder where you want the repository folder to be located. Right click there, and select Git GUI here.
Once Git GUI opens, select Clone Existing Repository.
Now, to get the repository link:
Open your repository. Click on Clone or download and copy the HTTPS link. (If it’s set to SSH, click on Use HTTPS in the top-right corner to switch to HTTPS).
Open your repository. Copy the HTTPS link (if it’s SSH, click on it to change it).
Now, in Git GUI, paste this link into the Source Location text field.
Enter the folder where you want the repository to be cloned in the Target Directory field. Make sure this folder does not already exist.
Click on Clone. If it asks you to log in (to your BitBucket/GitHub account), do so.
When it’s done cloning, you will see this Git GUI window:
This means that the repository has been created on your computer and that a connection has successfully been established to the website. You can close this.
Using the Git GUI, you can manage your repository. Go to the repository folder (the one you created while cloning it), right click and select Git GUI Here. The Git GUI window (seen in the screenshot above) will open.
As a demonstration, we’ll add a text file to the repository and upload it to the website. So, open the folder, and create a random text file and type anything in it.
After you save it, open Git GUI and click on Rescan.
Doing this will add your changes under Unstaged Changes. You can see your new text file there. Then, click on Stage Changed to accept the changes.
This will move your changes to Staged Changes. That means that you have accepted the changes, but you still have to pass them into the repository.
First, you need to enter a Commit Message. That is a simple message summarizing the changes you made. After you enter one, click Commit.
Your changes will be saved, but not yet pushed to the server, to the online repository (on GitHub/BitBucket). To do that, click on Push. Click on Push again in the new window that opens.
Now, if you open the repository on the website, you will be able to see the changes you made.
Sometimes, you might update the repository from the website itself, instead of doing it through the files on your PC. You might do that to edit the readme, for instance. If you do, you will have to update the changes from the repository to your PC. If you don’t, you will see this error when pushing your changes:
To update the repository on your computer, go to Remote > Fetch from > origin.
Then, go to Merge > Local Merge.
In the window that opens, select Tracking Branch and click on Merge.
Then, you should be able to push your changes normally.
Now you can use Git GUI to create repositories for your GameMaker projects!
Since you can’t clone repositories into existing folders, you will have to create a new folder for each repository you create and move your project there.
Check out my 9slice textbox scripts on GitHub, completely free and open-source.
See you later, and till then, happy dev’ing!