Behrang Saeedzadeh
Behrang Saeedzadeh

Reputation: 47961

Is there a way to clone a local git repository together with its staged and non-staged changes?

I want to write a script that clones a local git repo multiple times, but also copies over all non-committed changes over to the cloned repos. Is this possible?

Had a look at git-clone, but didn't see such an option.

Upvotes: 0

Views: 49

Answers (2)

Chronial
Chronial

Reputation: 70783

Do you have direct access to the repo you're cloning? If so, you can just commit all the changes in the source repo (git add -A, git commit -m "non-commited changes"). Then clone the repo and run git reset HEAD^ in those other repos. Once you are done with cloning, also run git reset HEAD^ in your source repo.

That should do exactly what you’re looking for.

Upvotes: 1

wRAR
wRAR

Reputation: 25560

Staged and non-staged changes are not a part of the repository so no, you cannot do that. If you want that you can just copy the directory with the repo and the working copy.

Upvotes: 7

Related Questions