Source Control Management using Git GUI

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

First, you’ll have to set up an account on a source control website. You can use GitHub or BitBucket.

The main difference between those two is that BitBucket allows private repositories (projects) for free, whereas GitHub doesn’t: you have to pay for private repos, and for free you can only make public ones.

So, 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:


BitBucket

0.PNG

Go to the BitBucket homepage. Click on the + icon (Create), then select Repository.

1.PNG

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.

2.PNG

When you click on Create repository, you’ll be greeted by an overview page. There, click on Create a README:

3.PNG

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.


GitHub

4.PNG

Go to the GitHub homepage and click on New Repository to create one.

5.PNG

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.



Git

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.emailuser.name if you’re using BitBucket. If you’re using GitHub, user.email is all you need to enter.

Cloning

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.

6.PNG

Once Git GUI opens, select Clone Existing Repository.

7.PNG

Now, to get the repository link:


GitHub


8-1.PNG

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).


BitBucket


9.PNG

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.10.PNG

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:

11.PNG

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.

Git GUI

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.

12.PNG

After you save it, open Git GUI and click on Rescan.

13.PNG

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.

14.PNG

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.

15.PNG

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.

Fetching Updates

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:

16.PNG

 

To update the repository on your computer, go to Remote > Fetch from > origin.17.PNG

Then, go to Merge > Local Merge.

18.PNG

In the window that opens, select Tracking Branch and click on Merge.

19.PNG

Then, you should be able to push your changes normally.

Conclusion

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!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s