DEV Community

The daily developer
The daily developer

Posted on

Git and Github tutorial part 3

We've talked about some important git commands in the two previous posts. In this one we're going to talk about how to work with remote repositories.

git clone

Let's say you want to get a specific repository from github and put it on your computer into a specific folder. The command below will do exactly that.

git clone remote_location clone_name
Enter fullscreen mode Exit fullscreen mode
  • remote_location represents a location (github repository SSH or HTTPS). After cloning the repository your remote address will be given the name "origin". This "origin" is an easier way to refer to that address later on.

  • clone_name is a name you want to give the folder you want your repository to be cloned in.

git remote -v

This command lists the name of the remote and and its location.

git fetch

The command git fetch will fetch the changes from the remote repository into your local repository.

git merge origin/main

This command merges origin/main into your local branch.

Top comments (0)