git - 如何从 git 存储库中取消链接分支?
问题描述
我想直接将内容推送到新的存储库。
目前,内容存在于现有存储库的其中一个分支中。
我已经试过了git remote remove origin
。
但是当我输入时git branch
,它显示的是以前的现有分支。需要帮忙。
解决方案
我想直接将内容推送到新的存储库
按着这些次序:
- 创建新存储库
- 将新存储库添加为新远程
- 将您想要的分支推送到新的远程
- (可选)从第一个远程删除分支
# 1. Create new repository
# Under your git server create new repository
# 2. Add the new repository as new remote
git remote add remote2 <url>
# 3. Push your desired branch to the new remote
git push origin2 <branch name>
# 4. OPTIONAL
# delete the branch from the first remote
git push origin :<branch name>
推荐阅读
- javascript - Redux - 如何对更改做出反应
- android - 纵向和横向模式的裁剪图像
- css - 我的图像在图像滑块上看起来很糟糕 - 我应该怎么做才能使我的图像看起来没有被拉伸?
- flutter - Flutter 中的 PKCS1 加密在没有反射的情况下将无法工作
- google-apps-script - Google Apps 脚本 - 更改 Gmail 中单个电子邮件的标签
- c# - 带有 DataContractJsonSerializer 的可选字段(如何更改默认值)
- ios - 如何在右侧的 UIButton 上添加图像并且 contentMode 不适用于图像?
- c# - 将 TextBox 的值填充到特定的文本框
- nest - Elasticsearch NEST Buckets 内部 Buckets 聚合
- c# - C# 将方法隐式转换为自定义类型