What is Git and Github?

Sabrina Windsor
3 min readApr 29, 2021

--

Before I started Unity Development, my knowledge surrounding Github and Git was very limited. Before now I only used Github to download files for various things, usually mods for videogames. But when it comes to making my own repositories and sharing code with others, I had no idea what was what. So what are these things?

Github is a site that hosts repositories of your project so that you can collaborate with a team without having multiple copies of said project. This prevents the possibility that these copies will later need to be merged and edited so that all the code is compatible. It helps with efficiency, plus, if someone writes code that ends up creating bugs, you can revert the project back to before they wrote that buggy code!

Git is the application that allows you to sync your project and Github together.

Let’s define some common terminology that you’ll likely be seeing as you learn your way through these programs:

Repository: This refers to a central location where everything is stored. This is where you will be saving code to so your teammates will be able access the changes you’ve made and vice versa.

Commit: This refers to the act of saving any changes you made to the code to the local repository.

Pull: Used to get the content from a remote repository to update the local repository to match.

Add: This command will add any changes that were made to the local repository. You can add things one at a time by typing exactly what you want to add and the press “/”, or you can just type “add .” to add everything.

Branch: This is an independent line of code. A project can have multiple branches and allows you to make changes to only a part of the project at a time. This is a big part in making sure bugs don’t get released to the public, as only the main branch will be published.

Master / Main: The default branch on github used to be master, but then they changed it to main. You can change the default, but ultimately this is the branch that gets published.

Head: The front, or the latest version.

Push: Used to send your commit onto the server so that it shows up on Github and your teammates will be able to update their own repositories to match.

Checkout / Switch: A command to switch the branch you are currently using.

Log: Use this command to see the history of all of the commits. To try out the project at a previous commit, copy the line of code next to the word “commit”, press “q” to exit the log, then treat it like you’re switching branches. Except, instead of a branch name, you’ll paste the code.

Revert: Undo certain changes. This will only affect the chosen commits, commits that happened after the reverted one will remain the same.

Reset: This is the potentially dangerous one. Using this command will force the branch or project into an earlier state, and everything that came afterward will be gone.

There are of course more commands, but these will likely be the most important ones to know. You can always type “ — help” in git for a list of more commands to use.

Using git might be confusing at first, but its a necessary part of working with a team in software development. Just keep using it, remember to pull, add, commit, and push often and eventually you’ll be a pro a navigating git and github. Don’t worry, you’ll get it!

--

--

Sabrina Windsor
Sabrina Windsor

Written by Sabrina Windsor

Currently learning to code with the help of GamedevHQ in order to someday my my game ideas come to life!

No responses yet