Learning Git

Aidan Horn
2 min readMay 22, 2022

--

Git is a more advanced system for collaboration on programming or markup code, compared to cloud storage. It is better because it offers the user greater control over what work they upload and when they upload it. Hosting the files on a central remote repository (“repo”) enables multiple users to clone the repo locally, and then work can be done offline. This facilitates open-source development. And it also easily enables scripts to read files on the remote repository.

The main learning curve is the set of commands to use in the Git Bash shell (which can be initiated by right-clicking in a directory in the file manager, and selecting “Git Bash here”). Bash is a form of command processor. This article aims to educate the reader, so that they can delve into using Git, and remote repositories, for collaboration in their work.

Where to start?

Git is a program that you need to install on your computer, from https://git-scm.com/downloads . On the official documentation page, you will find four videos to watch, and a link to the Visual Git Cheat Sheet, which describes the commands. The most fundamental commands are:

I recommend that you use the https protocol for Git, rather than the SSH protocol, as it is less of a headache.

  • git remote add origin "https://github.com/KevinKotze/sarbcurrent.git" (To connect your local repository to a remote repository. The usual name is “origin”.)
  • git clone (download a new remote repo)
  • git add file1 file2 file3 (stage files that are ready for a commit)
  • git rm file_x file_y (unstage files before a commit)
  • git commit -m"commit message" (Make a commit. The -a option bypasses the staging.)
  • git push (send updates to the remote repository, so that others can access them)
  • git pull (Get updates from other collaborators.)

Conclusion

I hope that you will start looking into using the Git system, for collaboration! I will update this article in future, as my experience with Git grows.

--

--

Aidan Horn
Aidan Horn

Written by Aidan Horn

Microeconometrician in SALDRU, School of Economics, University of Cape Town