Git设置不同的默认推送源和拉取源
参考: https://raw.githubusercontent.com/git/git/master/Documentation/RelNotes/1.8.3.txt
参考: https://stackoverflow.com/questions/2916845/different-default-remote-tracking-branch-for-git-pull-and-git-push
stackoverflow的关键字: triangular workflow
设置
# 设置默认push源
gp -u myfork # 不要用这一行
git config remote.pushDefault myfork # 等于在config增加了一行配置
[remote]
pushDefault = myfork
# 设置默认拉取源
.git/config # 这个配置文件
[branch "m"]
remote = team # 找到当前的工作分支, 然后, 把她的远程源设为要fetch的地址
merge = refs/heads/main # 这里要指定远程fetch的分支
定义
-
A triangular "pull from one place, push to another place" workflow is supported better by new remote.pushdefault (overrides the "origin" thing) and branch.*.pushremote (overrides the branch.*.remote) configuration variables.