🎓 A1Learner
🔍
0 of 50 lessons completed

Clone a Repository

Clone copies a whole repository onto your machine. It is how you start work on a project someone else made.

Copy the repository

The copy lands in a new folder beside the first one.

$ git clone ../remote.git ../my-notes-copy

The copy has the same history

All fifteen snapshots arrive with the copy.

$ git log --oneline

The copy is clean and up to date

The copy stays linked to the remote from the start.

$ git status

Example

$ git clone ../remote.git ../my-notes-copy
$ git log --oneline

Key points

  • Clone takes the address and a folder name.
  • It copies every snapshot, not just the newest files.
  • It sets the remote name to origin by itself.
  • It checks out the main branch for you.
  • The copy is a full repository. It works offline.
  • Clone once. The next lessons bring new work into the copy.

Here, the copy arrives with all fifteen snapshots. The newest sits at the top, as it did in the first copy.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What does clone copy?