Quick and Dirty Git

There are a lot of great resources on using git on the internet. This isn't one of them. This is a quick and dirty guide to get you going as quickly as possible, and not an in depth guide to the inner workings of git.

This guide will be focused around using a git gui called GitKraken. It has a paid version, but since we work only on open source work it is fine. I chose this tool because it is cross platform and easy to setup and use.

This guide may LOOK long, but that's just because I took a screenshot for EVERY BUTTON CLICK I made. This is to make sure I didn't miss a step. Setting everything up should take less than 10 minutes. If you have any trouble, just post in slack and you'll be sure to find some help!

Installation

  • Visit the website and download the app. The installation is short and painless and you will be presented with this screen:

  • Click the Create a GitKraken Account button

  • Fill out your account information. Then press the Create a GitKraken Account button

  • Click the Use GitKraken email. Make sure to verify the email you signed up with by clicking the link they email you in the next 10 days.

Setting up SSH

  • Next go to the preferences window...

  • Go to the Authentication tab, and press the Generate button.

  • This will take a second and show a green Success tag. Press the Copy to Clipboard button to store your public key on your clipboard. (If you accidentally Ctrl+C you can always come back to this screen to press that button to get the key).

Signing up for GitLab

We use GitLab over things like GitHub and BitBucket because they offer free unlimited size repositories. For game developers who can often have very LARGE repositories, this is wonderful!

  • To setup our GitLab account visit http://www.gitlab.com and press the Sign Up link in the top right.

  • Setup your account username, email, and password. Pass the robot test. You aren't a robot, are you? If so, get a human to help you with this part.

  • Next go to your email and confirm your account!

While you are there please make sure to email me telling me your gitlab username so I can add you to the game jammers group on gitlab!

  • Click on your gravitar on the upper right and select Profile Settings

  • Go to the SSH Keys section. (Also remember to email me your username and email you created your account with!)

  • Remember the SSH key we copied from GitKraken? Copy it into the key section here.

  • Also give your key a title. It doesn't matter what you put, but I usually name it after the computer I am currently using. (They key connects that computer with your gitlab account)

  • Press the add key button.

  • After I've told you you've been added to the gitlab group when you login to gitlab you should see the game-jammers group. Go ahead and click on the infection repository. Note: I switched to my main gitlab account from this point forward.

  • Click on the HTTPS drop down and select SSH

  • Click on the Copy to Clipboard button. This is the URL of the repository we will use to clone.

Cloning A Repository

Almost there! Lets go back to GitKraken.

  • From the File menu select Clone Repo

  • Paste the link we copied from gitlab into the URL area and configure the other settings. The Where to clone to is where on your local hard drive to put the repository when you grab it from the server. The full path lets you further customize the location. Press the Clone the Repo button once you are all setup.

  • GitKraken will start cloning the repository...

  • Click the Open Now button

DON'T PANIC

  • There are four areas.

    • The red circle on the left shows you the various BRANCHES of the repository. Don't worry about this right now, for our jams you'll probably be working out of master. Once you get more comfortable with Git we'll talk about that some more.

    • The red circle at the TOP are the repository commands. This lets you push changes to the server, pull them, stash your changes (I'll talk more about this later) etc

    • The Blue circle in the middle shows you the HISTORY. These are all the commits that were made to this branch, as well as who made them. Whew we worked hard on this project =D

    • The bottom area not circled shows you information about the selected commit. Each change is made as a commit, or a bunch of specific changes. In the screenshot above you can see the last change I made here made some changes to some prefabs, the EnvironmentLayers source file, etc.

Lets Make A Change

Okay, so how do you use this beast? Easy peasy. Let's make a change. Locate your repository on your hard drive (where you cloned it!) and find the README.md file. Open it in your favorite text editor.

  • I added a section at the bottom, go ahead and deface our beautiful readme file by telling everyone you were there. MAKE SURE YOU SAVE THE FILE =D

  • When you got back to GitKraken you'll see you have a new //WIP change! Go ahead and click on it.

  • Hey look, it's the readme file we changed. Go ahead and click on that.

  • Cool! GitKraken is showing us what changes we made. Green means we added things, red means we removed them.

  • Down at the bottom there is a Commit Message area. Fill that out with a helpful message about what changes you made. Then press the Save all changes button.

  • It looks like our change is a real commit now! See it at the top? Cool! The problem is that this change is currently only on our computer, we haven't pushed those changes to the server yet!

  • Before we push we need to make sure nothing new has happend on the server, so press the PULL button.

  • Likely nobody has made any changes since you cloned, but it's a good habit to pull before you push. If you accidentally forget, the tool might complain at you. If you have errors when you pull, take a screenshot and post it in slack! We'll help.

  • Now go ahead and push!

  • Hey our changes are propagated to the server! Good job!

Keep on Gitting

So what now? Well that's basically it! Make changes, Git notices changes were made. Create a commit when you want to save your changes. Pull, push, and repeat.

I hope this was helpful, please hit me up on email or slack if you have any problems!