In previous articles, we have learned the following:
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 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:
This is the result of cloning:
origin is already set for the remote location from where you clone the project.
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 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 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
This was it. Try these commands out, let me know of any confusion.
Thank you :)