The basics: Using Git for version control (Part 1: Using a command line editor — GitBash)

Chase Mitchell
3 min readApr 3, 2021

--

One of the first things you should learn as a developer is how to use Git services to create repositories and version control your projects. This makes it really easy to check feature implementations and share your work with a broader team, or the world!

Below are a few basics on getting started with Git and how to navigate the Git Bash program:

  1. There are two main platforms for this function which really are interchangeable. Those are GitHub and BitBucket. You can use either or both on a case by case basis, depending on the needs of your team.
  2. You will need to install the Git command line editor to communicate with these services. Git is the name of the software for this function, and can be downloaded at https://git-scm.com/ for PC or Mac.
  3. While a command line editor may be daunting at first, fear not! Using these tools is actually pretty straight forward. Here are a few useful commands you will need to get started. “ls” which stands for list, is a command that will list out all directories (folders) on your system. You can then change directories with the “cd” command by referencing the new directory you would like to enter. For example, if you enter “cd Desktop/” this will change your directory to the Desktop folder, in which you can use “ls” again and repeat this process to further drill down to the final directory you are looking for.

As you can see, my desktop directory is home mainly to some excellent RPGs!

4. You will ultimately want to search for a specific directory on your system, because typing names with spaces can be a little unintuitive (it requires some specific / and \ syntax, and you cannot simply use spaces to reference directory names within the command line program). Instead, use quotes to reference a specific folder as shown below.

A shortcut you can also use is by typing a few letters of the directory you want and pressing “Tab” to autofill the name.

5. “Help! I’m stuck!” Not to fear. If you get stuck in a directory who knows how many levels down and need an easy way to return to the top level — the following command will do just that! Input “$ cd $(git rev-parse — show-toplevel)” and then check your folder contents with “ls” and you should be all set.

That’s it for the Part 1 basics of navigating Git. We’ll go deeper in Part 2!

--

--

Chase Mitchell
Chase Mitchell

Written by Chase Mitchell

Unity Developer from Los Angeles, CA

No responses yet