I was searching for hours now but couldn't find a satisfying answere even though it appears to be simple noobish question. What I basically want to accomplish is to move my .git directory which currently resides besides my project folder down into the project folder. Optimally this shouldn't alter the repository history at all although I don't know whether this is actually possible. The reason I want to do this a somewhat IDE/project-type related problem I can solve this way.
I appreciate any help, thanks.
Mirroring a repositoryOpen Terminal . Create a bare clone of the repository. Mirror-push to the new repository. Remove the temporary local repository you created earlier.
Sure just move it, then do a
git add -A
git commit -m "moved project"
in the new root. It won't be a big change in terms of data. It's just going to change the current commit's tree. All objects already exist.
If you want your git repository to be changed so that it always looked like your files were located in the new path, you could re-write history similar to this
Otherwise, Adam's answer is what you want.
EDIT: Note that you should NOT use this if you or anyone else may be already using this repository as a submodule or a subtree anywhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With