Eze Jonathan
4 min readNov 27, 2022

My Git Cheat Sheet

Try to pronounce ๐Ÿ‘† that again. Try it again. Make it fasterโ€ฆ ๐Ÿ˜†

Alright, everything is Learnable & Teachable at Genesys Tech Hub, and so just like Coursera,ย Udemy, ALX Africa and other popular platforms out thereโ€ฆ we are convinced that equipping you with a tech skill is paramount.
Every year at Genesys Tech Hub, we have thousands of applications rolling in, but not everyone makes it to the end of the internship.
For a second, I want you to compare the Version Control Theory with our system of impacting knowledge at Genesys.
Every lecture is a short video presentation, with each session unlocking automatically after the previous session has been completed. This self paced system that we built for learning still allows you to leave a comment or feedback at the end of each video.
Learning or having to code is simple, but it gets ambiguous as you move on, no wonder debugging your codes can take days or even weeks.
Is it not amazing that something you started building gets overwhelming and out of your CONTROL? Often times you might need the assistance of another to be able to complete your project.

According to Simplilearn, multinational companies like Apple, Google, & Microsoft may face challenges ranging from collaboration among employees, storing several versions of files and data backing up. All these challenges need to be resolved for a company to be successful.
A set of people working on the same project from different regions may need to collaborate and work together.
The said project may go through several phases before completion, taking note and keeping track of each phase might be a challenge.

And so I want you to think of Version Control as a solution to these challenges.

What is version control?
Also known as source control, it is the practice of tracking & managing changes to files.

What then are Version Control Systems?
Version Control Systems are systems that record changes to a file or a set of files overtime so that you can recall specific versions of it later.

Some of the popular version control systems are Helix, Git & Mercurial. But in this piece, we would focus on using Git & Git Hub for version control & collaboration.

What is Git?
Git is an open-source, version control system created in 2005 by developers who were working on

the Linux OS, it is used for
~ tracking code changes
~ tracking who made the changes &
~ allowing the collaboration of a set of people working on the same project or code.
To get started with Git, first you need to go to their official website git-scm.com/downloads and download then install the software.

GitHub?
Github is a company founded in 2008 that makes tools which integrates with Git.
It is a code hosting platform for version control & collaboration. It lets you & others work together on projects from anywhere.
For you to be able to use GitHub, you need to go to github.com and sign up.

N/B: You don't need GitHub to use Git, but you can't use GitHub without Git.

Let's do a quick summary of some of the Git commands that you would need more often even as a beginner.

  • git --version ๐Ÿ‘ˆ if you have properly installed Git, this command shows you the Git version.
  • git config --global user.name "username" ๐Ÿ‘ˆ used to let Git know who you are.
    PS: it is advisable to use your GitHub name.
  • git config --global user.email "email address" ๐Ÿ‘ˆ used to set up your email.
  • git config --global --list ๐Ÿ‘ˆ this shows your global configuration.
    PS: Global configuration is like your ID, it goes with every commit message you send.
  • git in it ๐Ÿ‘ˆ used to initialize Git in your preferred folder; it makes git aware of the files in your folder.
  • git status ๐Ÿ‘ˆ tells us the status of Git at any point in time.
  • git add "file name" ๐Ÿ‘ˆ used to stage your file, it allows Git to track the changes made to the file you have chosen.
  • git addย . ๐Ÿ‘ˆ it allows Git to track multiple files simultaneously.
  • git commit -m "a description" ๐Ÿ‘ˆ used to make a commit.
  • git branch "name of the branch" ๐Ÿ‘ˆ used to create a new branch.
  • git checkout "name of branch" ๐Ÿ‘ˆ used to select a particular branch when needed.
  • git remote add origin "url" ๐Ÿ‘ˆ adds an online link to our local repository.
  • git remote -v ๐Ÿ‘ˆ it is used to show you the available remote links.
  • git branch -M main ๐Ÿ‘ˆ this command renames your branch from master to main.
  • git push -u origin main ๐Ÿ‘ˆ used to push your code from your local folder to the internet.
    PS: 'Origin' is the name youโ€™ve chosen to represent the url.
  • git pull origin main ๐Ÿ‘ˆ used to pull our code from the internet into our local folder.
  • git clone "git link to an online repository" ๐Ÿ‘ˆ used to clone an online repository.

We have covered the basics of what you need to know.
There are other advanced stuffs like hosting a simple website on GitHub, adding people to a repository, protecting a repository and so on.

Thanks for following through till the end.
For any further queries, or if you would need more resources that would guide you on Git workflow, feel free to send me an email. ๐Ÿ˜ƒ