Managing a Local Git Repository

One of the core components that make up a client's Website is its Git repository, which serves as a collaborative way to manage and track modifications to the code, assets, and other resources that make up the Website. This article discusses local management of such repositories and is most useful when you wish to begin development on a new or existing Website.


To perform the tasks in this article, you will need Git and its related components installed on your local computer. For specific instructions, please refer to one of the following knowledge base articles for your operating system:

Cloning a repository

When you clone a repository, you download a copy of the repository (and all its submodules) to your local computer. The master copy remains on the server. To clone a repository, do the following:

  1. Open a Git Bash shell (Windows) or terminal (macOS and Linux).
  2. Change directories to the folder where you want to store cloned repositories by using the cd command followed by the full path to the desired folder.
  3. Determine which branch of the repository you wish to clone. If you are going to be developing locally, you should clone the "develop" branch unless specifically instructed to use another. Replace "develop" in the command below with the name of the branch you wish to clone if this is the case.
  4. Determine whether you wish to include submodules in your local copy of the repository. A submodule is a reference to another repository inside of the first repository. In most cases, especially for client sites that use WordPress, you will want to include submodules, but you may remove the "--recurse-submodules" option from the command below if you do not wish to have them included.
  5. Run the following command to clone your repository into its own subfolder. Replace "clients/jemediacorp.git" in this example with the full name of the repository you want to clone.
    git clone --single-branch --branch develop --recurse-submodules
    Note: The above command clones the repository into a subfolder with the same name as the repository being cloned. To clone into a different folder, add the folder name at the end of the command, like this:
    git clone --single-branch --branch develop --recurse-submodules jemedia

If you receive an error during the cloning process, please see the troubleshooting Git commands knowledge base article.

Still need help? Get in touch!
Last updated on 20th Jan 2021