Skip to content
Home Tutorials Roadmaps Courses
Log in Join free
Tutorials Git Clone & Fork
Git Beginner FREE

Clone & Fork

Lesson 2 of 17 Beginner Interactive

git clone copies a repository. fork creates your own copy on GitHub.

Syntax

GIT
git clone https://github.com/user/repo.git
git clone --depth 1 URL
Clone and Fork
BASH
# Clone a repository
git clone https://github.com/user/repo.git

# Clone specific branch
git clone -b develop https://github.com/user/repo.git

# After forking on GitHub, clone your fork
git clone https://github.com/YOUR-USER/repo.git

# Add upstream remote
git remote add upstream https://github.com/original/repo.git

# Sync fork
git fetch upstream
git merge upstream/main

Practice

1
Exercise

Practice this concept.

Answer
Run the commands as shown above.

Quick Quiz

1

What did you learn?

This covers the basics.

Interview Questions

It is a fundamental Git feature.