經常是先克隆了原始專案查看,然後發現需要作些修改,就需要 Fork 到自己帳號下一份,所以要再修改一下遠端倉庫地址;
涉及命令為:git remote
;
# 查看遠端倉庫
git remote -v
# origin [email protected]:BrowserSync/browser-sync.git (fetch)
# origin [email protected]:BrowserSync/browser-sync.git (push)
# 重命名遠端倉庫
git remote rename origin BrowserSync
git remote -v
# 添加遠端倉庫
git remote add wdssmq [email protected]:wdssmq/browser-sync.git
git remote -v
# 獲取並查看分支資訊
git fetch --all
git branch -a
# -a 命令不懂啥用處
# git fetch -a
# 設置默認倉庫
git config branch.master.remote wdssmq
# 下邊命令可以直接修改遠端倉庫地址
# git remote set-url origin <url>
# 從另外的遠端庫合併更新
git merge --no-commit BrowserSync/master