Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何配置本地分支以永久跟踪git中不同名称的远程分支_Git_Bitbucket - Fatal编程技术网

如何配置本地分支以永久跟踪git中不同名称的远程分支

如何配置本地分支以永久跟踪git中不同名称的远程分支,git,bitbucket,Git,Bitbucket,这似乎是一个非常基本的操作,但我还没有找到一个结论性的答案 我经常在本地创建这样的新分支: git签出-b新功能 随后,我通过bitbucket或gitlab之类的东西创建了一个远程分支,并希望将本地分支链接到新创建的远程分支 我知道我可以通过以下方式推送到遥控器: git推送源新功能:bitbucket\u分支\u名称 但我觉得这很乏味,不知道是否有更优雅的解决方案,例如,将远程分支设置为跟踪一次,然后从那时起使用classicgit pull/git push。您要查找的命令是: git b

这似乎是一个非常基本的操作,但我还没有找到一个结论性的答案

我经常在本地创建这样的新分支:
git签出-b新功能

随后,我通过bitbucket或gitlab之类的东西创建了一个远程分支,并希望将本地分支链接到新创建的远程分支

我知道我可以通过以下方式推送到遥控器:

git推送源新功能:bitbucket\u分支\u名称


但我觉得这很乏味,不知道是否有更优雅的解决方案,例如,将远程分支设置为跟踪一次,然后从那时起使用classic
git pull/git push

您要查找的命令是:

git branch --set-upstream-to=origin/bitbucket_branch_name new_feature

了解更多信息。

您要查找的命令是:

git branch --set-upstream-to=origin/bitbucket_branch_name new_feature

了解更多信息。

您可以通过以下方式设置远程原点:

git remote set-url origin bitbucket_url
核实

git remote -v
下一个分支由

git branch -u bitbucket_branch_name/local_branch_name

从那时起,git pull/push默认使用它,即不需要url。

您可以通过

git remote set-url origin bitbucket_url
核实

git remote -v
下一个分支由

git branch -u bitbucket_branch_name/local_branch_name
从那时起,git pull/push默认使用它,即不需要url