4 Creating a Local Copy of an Existing Repository

You need to create a clone of a remote repository to start making changes to it. The git clone command initializes a new repository on your computer and fetches the entire history—all the changes that have been tracked during the life of that repository. After it’s complete, you can start making changes to the files in your local working tree and tracking commits locally.

Sometimes you don’t need the entire history of the repository. You don’t always need the last ten years of changes—the last year’s might suffice. You can use the --depth parameter to limit how many revisions you fetch. This is called a shallow repository.

There are a few limitations to this type of repository ...

Get Pragmatic Guide to Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.