[Video][Git Startup Tutorial] Setting up your own Git!

 

From TechCrunch, back in 2012: 

“GitHub is a Git repository hosting service, but it adds many of its own features. While Git is a command line tool, GitHub provides a Web-based graphical interface. It also provides access control and several collaboration features, such as a wikis and basic task management tools for every project.”

 

Everyone around software development, game development, mobile development, you name it – we should all have a tool that allows us to work in the same environment, at the same time, while not messing up with each other. Also, somewhere to save each and every single version of our program or app, in case we break something we can go back to a previous point – where everything is happy.

 

Git gives us those tools. It is hosted in “Repositories” online, usually for free but with premium functions, and we can all access them. The free versions are usually public. Everyone can take a look at your work, your code and copy it if they have the link. They cannot collaborate unless you allow them to, though, and that’s the beauty of it. You have your collaborators controlled, everyone knows what everyone else did and when, it works wonders.

 

Now, let’s get an account first:

Get an account

Get an account

 

Go to github’s main website, sign up for GitHub with any account you want or just create a new account altogether. After that’s done, we’re presented with an intro screen with nice design to guide us through our main page.

 

Main Page

Main Page

 

On this page, we get a short tutorial we can have, we can create repositories, find our teammates and to the bottom right, we have our current repositories. You can see I already have 3 repositories. These are for my game on Google Play, and two test ones for our previous tutorial experience.

 

In this case, we’re going to Create a Repository. So click on that.

Repository Creation

Repository Creation

 

Pick a short name, usually something related to your project. This name has to be memorable enough for you and your company or whoever you’re sharing with. I’m gonna create a third one, we’ll keep this one. I’ll name it StateMachineTutorial. You then hit Create repository and after that, you’re sent to a screen which gives you the Link for your repository.

Git Link

Git Link

 

 

Now, for the next part, we’re going to download SourceTree, just go to their website, hit the huge blue download button and install it. After you’re done, you’re left with a program that looks like this:

Source Tree

Source Tree

 

It might look scary, but it’s simple after you get used to it. For now, we’re going to create a repository and communicate it with the online repository we have on Git. Hit the Clone/New Button. In there, click “Create New Repository”.

 

Create New Repository

Create New Repository

 

All right, your Destination Path is where your game is. I’d recommend setting this folder’s name as the same your online repository has to avoid confusions. After this is created, you’ll have a new repository on your left side of the screen, like this:

 

Local Repository Created

Local Repository Created

 

Now, let me explain some concepts. First, a Remote is where the repository is hosted at. All those big buttons  have a meaning, here are the ones you’ll use the most:

 

  • Commit: Committing is sending a message to the online repository that “these files will change with my next push”. This way you let everyone on your team know (and Git), so they don’t work with your files. This is usually done after you work, but before you push.
  • Discard: Discards all local changes. This is done when your changes were just tests or you cannot push because of conflicts with someone else’s changes. Backup out of the folder if you’re gonna discard.
  • Stash: This saves your changes in a “stash”, which means they’re not uploaded but you can still check them/use them later.
  • Fetch: Gets the latest changes on the remotes.
  • Push: Uploads the Committed changes to your online repositories (Remotes).
  • Pull: Downloads changes from the selected remotes.
  • Terminal: Use this in case you need a specific function from Git that’s not easily attainable with the other buttons. Google knows a lot of code for this but that’s more advanced than I’ll go on this tutorial.

 

So, now that we know a Remote is the online part of our Git Repository, we need to add it to our new one. Right click over the Remote text, select New Remote and add the link Git gives you. Hit “Default Remote” and give it your username.

Linking local to online repos

Linking local to online repos

 

 

In the end, your repository will look somewhat like this:

 

End Result

End Result

 

 

Now click that “Unstaged Files” check. Be aware – the File Status tab on the bottom must be active. And then click Commit. Write a little message underneath the commit, check Push Changes Immediately and then click Commit on the bottom left again.

 

Done!

Done!

 

 

We’re done creating our first Git Repository! Now, the link to our git is https://github.com/lopezmramon/StateMachineTutorial.git , you can try to create a new Repo  for yourself!

 

Thanks for reading, meet you soon!

Share

Leave a Reply

Your email address will not be published. Required fields are marked *