Git clone other branch
If the repository is specified as a local path e.
Using an already existing repository as an alternate will require fewer objects to be copied from the repository being cloned, reducing network and local storage costs. Make a bare Git repository. Force the cloning process from a repository on a local filesystem to copy the files under the.
NOTE : this operation can race with concurrent modification to the source repository, similar to running cp -r src dst while modifying src. The files under. See git-maintenance[1].
If you want to break the dependency of a repository cloned with --shared on its source repository, you can simply run git repack -a to copy all objects from the source repository into a pack in the cloned repository. If these objects are removed and were referenced by the cloned repository, then the cloned repository will become corrupt. When using the --reference-if-able , a non existing directory is skipped with a warning instead of aborting the clone.
After the clone, a plain git fetch without arguments will update all the remote-tracking branches, and a git pull without arguments will in addition merge the remote master branch into the current master branch, if any this is untrue when "--single-branch" is given; see below. Set up a mirror of the source repository. Use the partial clone feature and request that the server sends a subset of reachable objects according to a given object filter.
Quick Introduction to Git and GitHub
When the repository to clone is on the local machine, instead of using hard links, automatically setup. When the repository to clone from is on a local machine, this flag bypasses the normal "Git aware" transport mechanism and clones the repository by making a copy of HEAD and everything under objects and refs directories.
Compared to --bare , --mirror not only maps local branches of the source to local branches of the target, it maps all refs including remote-tracking branches, notes etc. The resulting repository starts out without any object of its own. The clone. When this option is used, neither remote-tracking branches nor the related configuration variables are created.
This implies --bare. Requires --filter and --recurse-submodules. This obviously implies the --no-checkout because there is nowhere to check out the working tree. Progress status is reported on the standard error stream by default when it is attached to a terminal, unless --quiet is specified.
Vad är git config
It is safe, however, to run git gc , which uses the --local option by default. NOTE : this is a possibly dangerous operation; do not use it unless you understand what it does. The git-sparse-checkout[1] command can be used to grow the working directory as needed. This can be turned on by default by setting the clone.
If the repository is specified as a URL, then this flag is ignored and we never use the local optimizations. Transmit the given string to the server when communicating using protocol version 2. For more details on filter specifications, see the --filter option in git-rev-list[1]. If the reference repository is on the local machine, automatically setup.
Note that running git repack without the --local option in a repository cloned with --shared will copy objects from the source repository into a pack in the cloned repository, removing the disk space savings of clone --shared. Employ a sparse-checkout, with only files in the toplevel directory initially being present.
Breakdown of the 2nd command from above:
Borrow the objects from reference repositories specified with the --reference options only to reduce network transfer, and stop borrowing from them after a clone is made by making necessary local copies of borrowed objects. This flag forces progress status even if the standard error stream is not directed to a terminal. Fail if the source repository is a shallow repository. These objects may be removed by normal Git operations such as git commit which automatically call git maintenance run --auto.
This is a security measure to prevent the unintentional copying of files by dereferencing the symbolic links.
This may be desirable if you are trying to make a back-up of your repository. If you clone your repository using this option and then delete branches or use any other Git command that makes any existing commit unreferenced in the source repository, some objects may become unreferenced or dangling. Also apply the partial clone filter to any submodules in the repository.