如何在 Git 上重写一个 repo
How to rewrite a repo on Git
我正在做一个 Magento 项目,我有一个名为 Magento2
init 的目录作为 git 存储库。但是,我通常在 Magento2/app/code/Vendor/Module
的 repo 上工作,当我必须保存我的工作时,我使用
git add app/code/Vendor/Module
然后提交。您可以猜到,远程仓库的来源是 app/code/Vendor/Module
。一个新项目即将到来,我想将 Module
作为现有项目的新 git 存储库。这是一种将远程仓库与旧仓库断开连接,将其与新仓库连接并根据需要重写结构的方法吗?
Is this a way to disconnect the remote repository with the old one, connect it with the new one and rewrite the structure as desired?
是的,
添加或更新您的 git 存储库的远程。
添加新的远程位置
git remote add <new_name> <new_url>
正在更新当前远程位置
git remote set-url <current name [origin?]> <new_url>
验证 new/current 远程:
git remote -v
我正在做一个 Magento 项目,我有一个名为 Magento2
init 的目录作为 git 存储库。但是,我通常在 Magento2/app/code/Vendor/Module
的 repo 上工作,当我必须保存我的工作时,我使用
git add app/code/Vendor/Module
然后提交。您可以猜到,远程仓库的来源是 app/code/Vendor/Module
。一个新项目即将到来,我想将 Module
作为现有项目的新 git 存储库。这是一种将远程仓库与旧仓库断开连接,将其与新仓库连接并根据需要重写结构的方法吗?
Is this a way to disconnect the remote repository with the old one, connect it with the new one and rewrite the structure as desired?
是的,
添加或更新您的 git 存储库的远程。
添加新的远程位置
git remote add <new_name> <new_url>
正在更新当前远程位置
git remote set-url <current name [origin?]> <new_url>
验证 new/current 远程:
git remote -v