Questions tagged [clone]

A clone is a copy of an object with all of the same attributes, data, and methods as the original object. Or a software system that is designed to mimic another system.

A clone is a copy of an object with all of the same attributes, data, and methods as the original.

In practice, an object is cloned when you want to duplicate the original exactly and then change it in some way, such as changing a due date on a recurring task or linking it to a different object in a database hierarchy.

In computing, a clone is a hardware or software system that is designed to mimic another system.

See Also:

4519 questions
63
votes
6 answers

How to clone a Python generator object?

Consider this scenario: #!/usr/bin/env python # -*- coding: utf-8 -*- import os walk = os.walk('/home') for root, dirs, files in walk: for pathname in dirs+files: print os.path.join(root, pathname) for root, dirs, files in walk: …
Paulo Freitas
  • 13,194
  • 14
  • 74
  • 96
63
votes
9 answers

Git clone changes file modification time

When I clone a Git repository using the "git clone ..." command, all cloned files in my local repository have the same modification time with date and time as when the git clone command was issued. Is there a way to clone a remote Git repository…
user3302761
  • 631
  • 1
  • 5
  • 3
63
votes
11 answers

In Java, what is a shallow copy?

java.util.Calendar.clone() returns "...a new Calendar with the same properties" and returns "a shallow copy of this Calendar". This does not appear to be a shallow copy as answered here on SO. That question is tagged language-agnostic, Java does…
Will
  • 19,789
  • 10
  • 43
  • 45
61
votes
2 answers

How can I remove the working copy from a Mercurial clone?

When cloning a repository with mercurial you can pass the -U/--noupdate flag to create a clone with no working copy. Can I remove the working copy if I forget to pass this flag at clone time? And if so, how? This is conceptually similar to this git…
richq
  • 55,548
  • 20
  • 150
  • 144
61
votes
3 answers

Deep copy vs Shallow Copy

Possible Duplicate: What is the difference between a deep copy and a shallow copy? What is the difference between deep and shallow copy. What type of a copy does a copy constructor do?
Ankur
  • 1,189
  • 4
  • 12
  • 12
61
votes
5 answers

git clone and checkout in a single command

The following is the command I use to checkout a specific commit. git clone git://repo.git/repo123 git checkout I want to do the above in one step - using a git clone command only. The reason why I want to do this is, repo123 is very…
user2731584
  • 926
  • 1
  • 7
  • 17
59
votes
2 answers

How to copy/clone records in C# 9?

The C# 9 records feature specification includes the following: A record type contains two copying members: A constructor taking a single argument of the record type. It is referred to as a "copy constructor". A synthesized public parameterless…
mbabramo
  • 2,573
  • 2
  • 20
  • 24
59
votes
6 answers

Git clone with custom SSH using GIT_SSH error

I am trying to clone a Git repo using a custom SSH command. I set the SSH command in the GIT_SSH environmental variably be running export GIT_SSH="/usr/bin/ssh -o StrictHostKeyChecking=no -i /home/me/my_private_key". But when, after the previous…
Paris
  • 6,323
  • 7
  • 31
  • 49
57
votes
4 answers

When I make a draggable clone and drop it in a droppable I cannot drag it again

When I make a draggable clone and drop it in a droppable I cannot drag it again. How do I do that? Secondly I can only figure out how to us .append to add the clone to the droppable. But then it snaps to the top-left corner after any existing…
Cudos
  • 5,733
  • 11
  • 50
  • 77
56
votes
12 answers

git clone fails with "index-pack" failed?

So I created a remote repo that's not bare (because I need redmine to be able to read it), and it's set to be shared with the group (so git init --shared=group). I was able to push to the remote repo and now I'm trying to clone it. If I clone it…
gct
  • 14,100
  • 15
  • 68
  • 107
55
votes
5 answers

Mercurial clone from a branch

We have a repository with three named branches, I wanted to clone one of the branches. Is there a mercurial command to do that? If I provide the path (of branch) with hg clone I get 404 error.
Abidi
  • 7,846
  • 14
  • 43
  • 65
53
votes
3 answers

What happens when an Arc is cloned?

I am learning concurrency and want to clarify my understanding on the following code example from the Rust book. Please correct me if I am wrong. use std::sync::{Arc, Mutex}; use std::thread; use std::time::Duration; fn main() { let data =…
enaJ
  • 1,565
  • 5
  • 16
  • 29
51
votes
3 answers

Java : clone() operation calling super.clone()

I am not fully understanding the idea of returning super.clone() in the clone() method of a class. First of all, wouldn't that relate to it returning an object that is a superclass which contains LESS data than requested, because a superclass "is…
TurtleToes
  • 2,047
  • 2
  • 17
  • 17
51
votes
4 answers

git clone with different username/account

How can I clone a repository on git with an account that's different from what I was previously using? For example, I might have been using one account for cloning one repo, and now I need to access another repo that only a different account has…
David Callanan
  • 5,601
  • 7
  • 63
  • 105
50
votes
7 answers

jQuery Clone table row

I have a table with an Add button on the end. When you click this button I want a new table row to be created underneath the current one. I also want the input fields on this row to be blank. I am trying to do this using .clone() but it clones all…
Clinton Green
  • 9,697
  • 21
  • 68
  • 103