git解除与远程分支的关联 |
您所在的位置:网站首页 › git取消提交关联 › git解除与远程分支的关联 |
在工作中,经常需要将同一份代码传到不同的git仓库中去
如果本地同样一份代码,已经关联了一个与远程分支,那么怎么才能解除原程分支,并关联到一个新的分支将代码提交到新的分支上去呢? 1、如果你已经在远程创建了一个分支,远程分支地址:https://xxxxxxx/wangdong/helloworld.git 2、从命令行创建一个新的仓库,关联到该远程分支 touch README.md git init git add README.md git commit -m "first commit" git remote add origin https://xxxxxxx/wangdong/helloworld.git git push -u origin master 1234563、如果本地的代码,没有关联任何远程分支 git remote add origin https://xxxxxxx/wangdong/helloworld.git git push -u origin master 124、如果本地代码,已经关联了远程分支,则需要先解除关联 git remote remove origin 15、解除后、重新关联新的远程分支,并将代码传上去 ~/dev33/alioss-file on master ⌚ 10:44:56 $ git remote add origin https://dev.33.cn/wangdong/alioss-file.git 12 ~/dev33/alioss-file on master ⌚ 10:45:01 $ git push -u origin master Counting objects: 102, done. Delta compression using up to 8 threads. Compressing objects: 100% (82/82), done. Writing objects: 100% (102/102), 62.52 KiB | 7.81 MiB/s, done. Total 102 (delta 26), reused 0 (delta 0) To https://dev.33.cn/wangdong/alioss-file.git * [new branch] master -> master Branch master set up to track remote branch master from origin. 123456789106、完成 |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |