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.
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.
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.