Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.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
使用不同的ssh机器将git远程分支带到本地_Git - Fatal编程技术网

使用不同的ssh机器将git远程分支带到本地

使用不同的ssh机器将git远程分支带到本地,git,Git,我用了两台机器 我已经克隆了一个应用程序的git存储库 在机器A上,我克隆了这个repo,在我创建、提交和远程推送的不同分支上开发了各种功能 所以我现在有三个分支,一个是主分支,其余两个分支1,分支2 在机器2上,我克隆了存储库“master”分支 我的问题是如何在我的机器2上得到branch1,branch2 这样我也可以从机器2提交东西 提前谢谢 (抱歉英语不好)你可以 git fetch --all git branch -r # will list all remote branches

我用了两台机器

我已经克隆了一个应用程序的git存储库

在机器A上,我克隆了这个repo,在我创建、提交和远程推送的不同分支上开发了各种功能

所以我现在有三个分支,一个是主分支,其余两个分支1,分支2

在机器2上,我克隆了存储库“master”分支

我的问题是如何在我的机器2上得到branch1,branch2

这样我也可以从机器2提交东西

提前谢谢

(抱歉英语不好)

你可以

git fetch --all
git branch -r # will list all remote branches
git checkout <branch> # notice that the branch name should not have leading 'origin', it is the *local* branch name
git fetch--all
git branch-r#将列出所有远程分支
git checkout#注意分支名称不应该有前导的“origin”,它是*local*分支名称
git将创建跟踪同名远程分支的本地分支

同时检查。

您可以

git fetch --all
git branch -r # will list all remote branches
git checkout <branch> # notice that the branch name should not have leading 'origin', it is the *local* branch name
git fetch--all
git branch-r#将列出所有远程分支
git checkout#注意分支名称不应该有前导的“origin”,它是*local*分支名称
git将创建跟踪同名远程分支的本地分支


同时检查。

您可以使用bitbucketYou可以使用BitBucketHanks进行回复。成功了。因此,如果我从机器2提交并推送我的更改,我将不得不执行“git pull branch_name_i_committed_in”。我说得对吗?@jospratik是的,你说得对。此外,它还介绍了一种更好的实践,即有选择地使用
git-pull
git-pull--rebase
。感谢您的回复。成功了。因此,如果我从机器2提交并推送我的更改,我将不得不执行“git pull branch_name_i_committed_in”。我说得对吗?@jospratik是的,你说得对。此外,它还介绍了一种更好的实践,即有选择地使用
git-pull
git-pull--rebase