git - 在 git 中列出特定远程的分支

标签 git ruby-on-rails-4 ubuntu-14.04 git-branch

我在一个项目中添加了多个 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/

相关文章:

shared-libraries - libltdl.so.3 : cannot open shared object file: No such file or directory in Ubuntu 14. 04

git - 我如何在 Git 中使用 AC_REVISION?

sql - 有没有办法使用组来选择 Rails 中分组记录的 ID?

ubuntu-14.04 - 在 Ubuntu 14.04 上使用 Netbeans 8 时不会显示 PlantUML 插件的新项目选项

mysql - 服务器关闭并重新启动后,Laravel 5.1 时区与 PHP 不同步 - 命令行重新设置

ruby-on-rails - form_for helper 中的路径不正确

仅在新分支上的 Git post-checkout Hook

xcode - 失败的 Xcode Git Merge 卡住了

python - 无法将 python 代码部署到 heroku

ruby-on-rails - 使用存在和正则表达式格式的 Rails 验证