且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在git中设置默认遥控器?

更新时间:2022-04-15 00:12:37

没有默认的远程服务器,每个分支都可以从远程存储库中跟踪特定的分支.

There is no default remote, each branch can track a specific branch from a remote repo.

如果您使用 git checkout -b< branch-name> 创建了分支,其中< branch-name> 是远程分支的名称,则新分支跟踪该分支(从任何远程托管它的分支).

If you have created the branch using git checkout -b <branch-name> where <branch-name> is the name of a remote branch then the new branch tracks that branch (from whatever remote hosts it).

如果您在本地创建分支,则使用 git push --set-upstream< remote-name>< branch-name> ,然后本地分支< branch-name> 跟踪远程分支< remote-name>/< branch-name> .

If you created the branch locally then used git push --set-upstream <remote-name> <branch-name> then the local branch <branch-name> tracks the remote branch <remote-name>/<branch-name>.

您始终可以使用 gitbranch --set-upstream-to 更改当前分支或

You can always use git branch --set-upstream-to to change the remote branch that is tracked by the current branch or git branch --unset-upstream to tell it to not track any remote branch.