Understanding Git and GitHub

Understanding Git and GitHub

·

3 min read

First of all, Git is to GitHub – what porn is to pornhub.

Let me tell you a story.

Back when I started out coding and had to collaborate with another developer, I would send the backend guy a zipped version of my frontend code – either in a flash drive, or via email, and whenever I needed to make further UI changes, he would send back the codebase [including his backend code], and I would have to navigate the codebase to make my changes without messing up my guy’s backend code.

So Rookie! But hey! We got the job done. Most importantly, I had fun doing it.

Imagine the horror if it was a large project – with over 15 developers working on it.

By the way, I started out doing web design – using HTML, CSS, and jQuery because it was the only coding space I felt I could immediately see the effect of my code.

For some reason, the resources I could lay my hands on – made zero references to Git or GitHub, so I had no idea what those terms meant. Even after I finally got to know of them, the concepts got more and more confusing than I’d like to admit.

Now that I understand the concepts, it has been a fun ride.

Git and GitHub are two very different entities, and can not be used interchangeably.

Git is a distributed version control system; this means It allows us to track changes in an application, in a folder, in a single file – over time, across different users, and different computers.

GitHub is like a social network or platform for Git repositories; a repository is a set of files for a project. GitHub allows us to share our repositories with team members, publish things online, and collaborate on open-source projects.

Git can be used on its own. It is the main technology, while GitHub is the platform to share it and collaborate using Git.

The first step to becoming a Git-GitHub rockstar is to try out this simple task;

Let’s create a simple repository containing a readme.txt file.

  1. Download Git here

2. Register on GitHub , and create a repository.

3. Now create a “readme.txt” file in a folder on your desktop.

4. Open this folder > Right-click > Now click the “Git Bash Here” option to open the terminal.

5. In the terminal, type git init then press enter

6.

git add readme.txt

7.

git commit -m "first commit message"

8.

git remote add origin URL [copy this URL from your repository page]

9.

git push -u origin master