Git管理多个远程分支

首先Git不能单独设置pull和push的源,也就是说pull和push的只能保持一致!git

背景:
本人的博客是基于hexo-theme-next的,可是由于我的喜爱,基于源码作了一写改动。但是官方源码更新了我也要跟着一块儿更新呀,因而使用git设置不一样的源来保持和官方同步更新。github

查看本地源segmentfault

> git remote -v
https://github.com/xmvper/xmvper.github.io.git

查看远程分支和本地分支的对应关系bash

> git branch -vv
* master 77e072b [origin/master] curl新增参数

添加源hexo

> git clone https://github.com/xmvper/hexo-theme-next.git
> git remote add office https://github.com/theme-next/hexo-theme-next.git

新增分支指向office/master 分支curl

# 检出office/master分支到本地,并命名hexo-theme-next
> git checkout -b hexo-theme-next office/master

或者,先新建分支,而后设置upstream
> git branch hexo-theme-next
> git branch --set-upstream-to=office/master hexo-theme-next  或  git branch -u office/master hexo-theme-next

最后,基于本身的喜爱修改文件,再把修改后的内容提交到本身的仓库学习

> git push origin hexo-theme-next



欢迎订阅「K叔区块链」 - 专一于区块链技术学习

博客地址: http://www.jouypub.com
简书主页: https://www.jianshu.com/u/756c9c8ae984
segmentfault主页: https://segmentfault.com/blog/jouypub
腾讯云主页: https://cloud.tencent.com/developer/column/72548
相关文章
相关标签/搜索