In this document, we'll touch on some other common options. Other configuration optionsįor a comprehensive list of other git clone options visit the official Git documentation. Giving you exact 'mirrored' functionality. You can then run git remote update on the mirror and it will overwrite all refs from the origin repo. In addition, -mirror will clone all the extended refs of the remote repository, and maintain remote branch tracking configuration. Resulting in a bare repo with no editable working files. This means the behavior of -bare is inherited by -mirror. Passing the -mirror argument implicitly passes the -bare argument as well. Like git init -bare, this is used to create a hosted repository that developers will not edit directly. In addition, no remote branches for the repo will be configured with the -bare repository. This means that a repository will be set up with the history of the project that can be pushed and pulled from, but cannot be edited directly. Similar to git init -bare, when the -bare argument is passed to git clone, a copy of the remote repository will be made with an omitted working directory. This is purely a convenience utility to save you time from downloading the HEAD ref of the repository and then having to additionally fetch the ref you need. This above example would clone only the new_feature branch from the remote Git repository. The example below demonstrates how to obtain a local copy of a central repository stored on a server accessible at using the SSH username john: This automatic connection is established by creating Git refs to the remote branch heads under refs/remotes/origin and by initializing and configuration variables.Īn example demonstrating using git clone can be found on the setting up a repository guide. This makes it very easy to interact with a central repository. This is sort of like SVN checkout, except the “working copy” is a full-fledged Git repository-it has its own history, manages its own files, and is a completely isolated environment from the original repository.Īs a convenience, cloning automatically creates a remote connection called "origin" pointing back to the original repository. The git clone command copies an existing Git repository. The original repository can be located on the local filesystem or on remote machine accessible supported protocols. Git clone is primarily used to point to an existing repo and make a clone or copy of that repo at in a new directory, at another location. The point is, this is accomplished through conventions rather than being hardwired into the VCS itself. For example, by simply designating one Git repo as the “central” repository, it’s possible to replicate a centralized workflow using Git. Of course, there’s nothing stopping you from giving certain Git repos special meaning. Instead of checking a working copy into SVN’s central repository, you push or pull commits from one repository to another. Whereas SVN depends on the relationship between the central repository and the working copy, Git’s collaboration model is based on repository-to-repository interaction. This makes collaborating with Git fundamentally different than with SVN. Unlike SVN, Git makes no distinction between the working copy and the central repository-they're all full-fledged Git repositories. It’s important to understand that Git’s idea of a “working copy” is very different from the working copy you get by checking out code from an SVN repository. Once a developer has obtained a working copy, all version control operations and collaborations are managed through their local repository. Like git init, cloning is generally a one-time operation. If a project has already been set up in a central repository, the git clone command is the most common way for users to obtain a development copy. Purpose: repo-to-repo collaboration development copy This page will explore more complex cloning and configuration scenarios. On the setting up a repository guide, we covered a basic use case of git clone.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |