预备知识
Git usage git 里的origin表示:你现在所在仓库mapping的远端仓库的全路径的简写,可以用git remote -v查看
e.g. 这里的origin=https://github.com/changpzh/abbreviation_checkTool.git
$ git remote -v
origin https://github.com/changpzh/abbreviation_checkTool.git (fetch)
origin https://github.com/changpzh/abbreviation_checkTool.git (push)
[实际使用场景]: rebase 【变基】非默认仓库代码
- 第一: 新建一个远程仓库关联到你本地
$ git remote add 5g git@baltig.nsn-net.net:5g/nodeoam.git
- 第二: 查看是否添加成功
$ git remote -v
5g git@baltig.nsn-net.net:5g/nodeoam.git (fetch)
5g git@baltig.nsn-net.net:5g/nodeoam.git (push)
origin git@baltig.nsn-net.net:hzoam/nodeoam.git (fetch)
origin git@baltig.nsn-net.net:hzoam/nodeoam.git (push)
- 第三: 拉取前面两个远程仓库的所有代码下来
$ git fetch --all
- 第四: rebase 远程分支的【目标仓库/目标分支】的最新代码到你本地branch用【可以省略当前分支名】
$ git rebase 5g/5G_Poc_OAM_1
- 第五: 完后用下面命令提交到库上你的分支,rebase后一定要用-f选项
git push -f origin [your_remoteRep_target_branch]
本文介绍了如何使用Git命令来管理远程仓库,包括添加新的远程仓库、拉取代码、rebase操作及推送更改等内容。通过具体步骤说明了如何针对特定远程分支进行变基(rebase)并提交到目标仓库。

被折叠的 条评论
为什么被折叠?



