我在一个项目中添加了多个 Remote 。
如何使用分支检查该远程上的特定分支和推送代码。
例如。
origin https://example1@bitbucket.org/username/repo.git (fetch)
origin https://example1@bitbucket.org/username/repo.git (push)
stash http://example2@stash.xyz.com/scm/omed/repo.git (fetch)
stash http://example2@stash.xyz.com/scm/omed/repo.git (push)
这里添加了两个 Remote 。
目前我只有 origin 分支而不是 stash 分支。
我想列出特定远程的所有分支。
当我做
git branch -a
我只看到起源的分支我需要列出 stash 远程分支的命令。
最佳答案
此步骤如下。
1) 获取远程信息。在这种情况下,stash 是远程名称。
git fetch stash
2) 显示远程分支
git branch -a
3)现在您可以创建由远程分支跟踪的本地分支,如下所示。
git checkout -b <branche-name> stash/<branch-name>
4)使用远程名称 pull 或推
git pull stash <branch-name>
git push stash <branch-name>
关于git - 在 git 中列出特定远程的分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29486614/