0

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.

Behrang
  • 46,888
  • 25
  • 118
  • 160

2 Answers2

7

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.

wRAR
  • 25,009
  • 4
  • 84
  • 97
  • 1
    Actually, in a weird sense, staged changes _are_ in the repository (they're loose objects whose reference is only in the index, not in any commit in the commit-tree), but in practice your answer (just copy the thing directly) is the easiest way to go. :-) – torek Feb 28 '13 at 01:39
1

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.

Chronial
  • 66,706
  • 14
  • 93
  • 99