git 修改当前分支的远程关联分支

修改当前分支的远程关联分支,请使用 git branch 命令和 –set-upstream-to 选项。假设你当前在 master 分支,想要将其与远程仓库的 origin/new-branch 分支关联起来,可以执行以下命令:

git branch –set-upstream-to=origin/new-branch

这会将当前分支(master)与远程仓库的 origin/new-branch 分支关联起来。现在,当你在当前分支上执行 git pull 或 git push 命令时,Git 将自动使用远程仓库的 origin/new-branch 分支进行更新和推送。

注意:如果你已经与另一个远程分支建立了关联,可以使用 git branch –unset-upstream 命令取消它,然后再使用 –set-upstream-to 选项建立新的关联。

Leave a Reply

Your email address will not be published. Required fields are marked *