移动一个git仓库 [英] Moving a git repository

查看:143
本文介绍了移动一个git仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题可能很愚蠢,但我一直在想它。这是关于git仓库的,但我认为它与其他DVCS的本地仓库是一样的。



可以说我的项目在启动时就是这样的:




  • 项目

    • .git

    • 所有其他文件夹该项目




这就是为什么当它设置正确时它会如何工作?

可以说我把Project文件夹移到其他地方,我是否需要改变任何东西?或者是.git文件夹中的所有存储库内容仅与项目文件夹相关,而忽略了Project上的整个文件树。



我很确定移动Project不会但是我只是想确定。

解决方案

是的, .git 是相对的。但是,如果您已将存储库作为另一个存储库的命名远程名称添加,则必须更改该存储库中的远程URL。


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:

  • Project
    • .git
    • all the other folders in the project

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.

解决方案

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.

这篇关于移动一个git仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆