This question may be dumb, but I've been wondering it for a while. It's about git repositories, but I assume it's the same for local repositories for other DVCS'.
Lets say my project is like this when it starts:
So that's how it would work when you set it up right?
Lets say I move the Project folder somewhere else, would I have to change anything? Or is all the repository stuff in the .git folder relative only to the Project folder ignoring the whole file tree above Project.
I'm pretty sure moving Project wouldn't matter but I just wanted to make sure.
You first have to get the original Git repository on your machine. Then, go into the repository. Finally, use the --mirror flag to copy everything in your local Git repository into the new repo.
Clone the original repository onto your computer, and pull down the branches you want to preserve. Reset the repo's remote URL. See the GitHub documentation for more information. Then push the branches with git push --all .
I've found that submodules are not relative in git.
So, if you want to move a project that contains submodules, you have to edit the .git
file in the submodule, as well as the "worktree" attribute in the submodule config file, which is stored in the parent's .git/modules/MODULENAME/config
file.
Yes, everything in .git
is relative. If you have added the repository as a named remote to another repository, you would have to change the remote URL in that other repository, though.
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