Sign in

Using Version Control

Whether it’s in the office or around the world, at some point, you’ll have to collaborate with others. And with this, it brings a heap of issues to the table, from pushing the work you’ve done to not having the latest updates. This is where version control comes in. Although there are multiple applications that offers version control, from SVN to Bitbucket, the one I decided to use is GitHub.

When using GitHub, always remember the three steps: Pull, Commit, and Push

  • Pull gives you the the “latest” version of the application/branch you’re working on from the remote repository, thus not having deal with conflicting issues or redo work someone else in the team had already done
  • Commit lets you record changes to the repository and gives you a way to set up any updated files/folders that needs to be deposited to the remote repository
  • Push sends all the updated files/folders you have committed to the remote repository, permitting those in the team to access and view the work you’ve done.
General sense of using Github for Version Control

The Beginning

When you first start out on GitHub, you’ll have to create a remote repository for your game. Choose a name you want for the new repository, set it to Public or Private, and can tell GitHub to ignore unnecessary files by adding a .gitignore file in the repository

Once you create the remote repository, it’s time to link it to your project. After copying the repository URL link from GIthub, boot up Git Bash, and change the current directory to the project you want to use.

Next, you’ll need to initialize the repo:

You have to do once and this command will create a local Git repository. Now, you can link the local repository to the remote repository you just created on GitHub by issuing this command

Using Git

At this point, you’ve already set up your repositories (both local and remote) and now ready to pull, commit, and push your work!

Should always be the first thing you do before you start working. This ensures your local repository is current

Before you can commit, you should always check the status of the repo as this will help you determine if there’s anything that will be added/deleted from the repo once you push your commit.

If you have any files/folders you want to add to the repository, you can add them using this command:

Lastly, before you commit, it’s always important to add a comment on what the commit was in case you need to revert back.

Once you commit your work, it’s time to push it to the remote repository.

Useful Tidbits

Although Pull, Commit, and Push is what you’ll use on a day-to-day basis, sometimes, there are other things you just need to do in order to get the project back up and running.

Like a tree, Git repositories can have many branches, and, with this, it allows the multiple teams to work on the project, organize it, and maintain a safeguard over the project.

Basic commands for branches in Git are:

However, do note that whenever you pull from a different branch, anything that’s not part of the branch you want to switch to will disappear.

If, on the other hand, you’re done with the current branch and want to merge it with another branch, type this command

Revert/Reset

Although it’s always better to create a new branch to test out things, sometimes it’s better to revert or reset the project to an earlier time.

In addition, even though both revert and reset achieve similar things, it’s important to note the difference:

If you’ve decided that it’s better to revert/reset, proceed with caution and type the following commands