首先Git不能单独设置pull和push的源,也就是说pull和push的只能保持一致!
背景:
本人的博客是基于hexo-theme-next的,但是因为个人喜好,基于源码做了一写改动。可是官方源码更新了我也要跟着一起更新呀,于是使用git设置不同的源来保持和官方同步更新。
查看本地源
> git remote -v https://github.com/xmvper/xmvper.github.io.git
查看远程分支和本地分支的对应关系
> git branch -vv * master 77e072b [origin/master] curl新增参数
添加源
> 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 分支
# 检出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