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
相關文章
相關標籤/搜索