经常是先克隆了原始项目查看,然后发现需要作些修改,就需要 Fork 到自己账号下一份,所以要再修改一下远程仓库地址;

涉及命令为:git remote

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 查看远程仓库

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