Git 101: The Ultimate Beginner’s Guide to Version Control

Rishabh IO
FourOFour
Published in
3 min readMar 20, 2023
Understanding Git and difference between Git vs Github

# Introduction

Git and Github are two of the most important tools in a software developer’s toolkit. Git is a version control system that allows developers to keep track of changes to their code over time, while Github is a web-based platform that provides a centralized place to store and collaborate on Git repositories.

# Problem Solved by Git

Before Git, developers used to keep multiple versions of their code in different folders or directories, which made it difficult to keep track of changes and collaborate with other developers. Git solved this problem by providing a centralized repository where all changes are tracked and can be easily managed and collaborated upon.

# Difference between Git and Github

While Git is a version control system, Github is a web-based platform that provides a centralized place to store and collaborate on Git repositories. Github provides additional features such as issue tracking, pull requests, and code reviews, which make it an invaluable tool for software development teams.

# Prefer a detailed Video Tutorial?

For a more detailed tutorial on how to use Git and Github, check out this video tutorial:

Intro to Git and Github with Rishabh IO

# Alternatives to Git and Github

While Github is the most popular platform for hosting Git repositories, there are other alternatives available such as Bitbucket and GitLab. Each platform has its own unique features and benefits, so it’s important to choose the one that best fits your needs.

## Basic Github Commands

git init

Initialize an empty Git repository in the current directory.

$ git init

git clone

Clone a repository from a remote location.

$ git clone https://github.com/<user_name>/<repo_name>.git

git add

Add files to the staging area.

$ git add filename.txt

git commit

Commit changes to the repository.

$ git commit -m "Commit message"

git status

Check the status of the repository.

$ git status

git diff

Show changes between commits, commit and working tree, etc.

$ git diff

## Branching Commands

git branch

List, create, or delete branches.

$ git branch feature

git checkout

Switch branches or restore working tree files.

$ git checkout feature

git merge

Join two or more development histories together.

$ git merge feature

git rebase

Reapply commits on top of another base tip.

$ git rebase master

## Remote Commands

git remote

Manage set of tracked repositories.

$ git remote add origin https://github.com/user/repo.git

git fetch

Download objects and refs from another repository.

$ git fetch origin

git pull

Fetch from and integrate with another repository or a local branch.

$ git pull origin master

git push

Update remote refs along with associated objects.

$ git push origin master

# Summary

Git and Github are essential tools for modern software development. They allow developers to easily collaborate and manage changes to their code over time. By understanding the difference between Git and Github, and learning some basic Github commands, you’ll be well on your way to becoming a proficient software developer.

# Credits

Inspired by this article published on fourofour

--

--

Rishabh IO
FourOFour

Rishabh.IO envisions breaking complex phenomenon into enjoyable digital stories one at a time.