GitHub Commands For Daily Usage

Shameel Uddin's photo
Shameel Uddin
·May 30, 2022·

2 min read

Subscribe to our newsletter and never miss any upcoming articles

In previous articles, we have learned the following:

  1. Need of Version Control System

  2. Git Basics

  3. Setting Up GitHub

  4. Creating Repository on GitHub for the First Time

Now we are going to learn most important commands which are used on day-to-day tasks.

We will be discussing

  • git clone
  • git pull
  • git fetch
  • git push

Their differences and usages.

Git Clone

git clone is a simple command which downloads a local copy of the project from remote repository to your local computer.

Complete syntax is this: git clone <link>

This is how you copy the link: Image description

This is the result of cloning: Image description

origin is already set for the remote location from where you clone the project.

Git Fetch

Since you are working with remote repository so there must be other folks working on it.

At first glance, git fetch looks like a command to download the changes locally to your computer but it only downloads the metadata and informs you of the changes.

Git Pull

git pull helps you download the changes made by others.

As we studied in last article, you can set pointers for remote locations, i.e., different repositories and choose to pull data from any of your desired repository.

Git Push

git push helps you upload changes back to the repository considering you have the rights to do so.

For remote pointers, you can choose to pull data from one repo and push into another repo.

For example, you are downloading data from origin and uploading to dev pointer.

This was it. Try these commands out, let me know of any confusion.

Thank you :)