|
git 切换远程地址分支 推送到指定地址分支
切换远程地址
1、切换远程仓库地址:
方式一:修改远程仓库地址
【git remote set-url origin URL】 更换远程仓库地址,URL为新地址。- git remote set-url
- https://gitee.com/xxss/omj_gateway.git
复制代码
方式二:先删除远程仓库地址,然后再添加
【git remote rm origin】 删除现有远程仓库
【git remote add origin url】添加新远程仓库
- git remote rm origin https://github.com/****/omj_gateway.git
- git remote add origin https://gitee.com/xxss/omj_gateway.gi
复制代码
2、【git remote -v 】查看远程仓库的地址
- omj_gateway https://github.com/****/omj_gateway.git (fetch)
- omj_gateway https://github.com/xxs/omj_gateway.git (push)
- origin https://gitee.com/xxss/omj_gateway.git (fetch)
- origin https://gitee.com/xxs/omj_gateway.git (push)
复制代码
推送到指定地址分支
1、查看本地址和远程版本
- git branch -a
- debug
- * develop
- main
- remotes/omj_gateway/develop
- remotes/omj_gateway/main
- remotes/origin/HEAD -> origin/main
- remotes/origin/develop
- remotes/origin/main
复制代码 remotes代表远程分支
2、依据【git remote -v 】查看远程仓库的地址主机名地址分支,推送到指定地址分支
git push <远程主机名> <本地分支名>:<远程分支名>
例:
- git push omj_gateway develop:develop --force
复制代码
|
+10
|