- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
创建一个新的 git 分支:
git checkout -b test
并将其推送到原点:
git push origin -u 测试
并列出我现在得到的所有分支:
master
* test
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/test
现在,我想在另一台机器上执行一个命令来获取远程分支引用。我该怎么做?
我想要输出:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/test
并且该命令不知道新分支的名称。
我尝试过:git pull
、git pull --all
、git fetch
、git fetch --all
。还有什么?
编辑:我需要一个命令告诉我:
* [new branch] test -> origin/test
如果不先 checkout 分支,这可能吗?我也不想删除我的存储库并再次克隆它。
最佳答案
on another machine I want execute a command to get the remote branch refs.
您可以启动一个空的 repo,添加一个源并执行 ls-remote(如完成 in the comments of your other question ):
git init newRepo
cd newRepo
git remote add origin /url/remote/repo
git ls-remote origin
这允许您查看远程仓库的分支,而无需在本地克隆/获取任何内容。
由于您在一个空的存储库中,因此您可以决定要获取的内容。
作为jthill提及 in the comments , git ls-remote
部分不需要从 git 存储库运行。
例如,考虑:
cd / # to illustrate that you can be anywhere
git ls-remote git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 'refs/heads/*'
如果您已经有一个克隆的 repo,并且不介意下载 delta,那么 git fetch 应该可以工作,前提是它的 refspec 设置为获取所有分支。
(同样,如您的其他问题“git checkout new remote branch when cloning with depth 1 option ”所示)
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
关于git - 如何将 git 远程分支引用带到本地,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18592397/
我正在尝试在 Android 上实现以下设计。 我知道要在那个位置放置按钮,我应该有两个约束布局;一种用于整个更改密码表单,另一种用于不带保存按钮的更改密码表单,然后将保存按钮的 Top 和 Bott
我必须从原始数据中获取声音并在listview中显示它们,我可以做到这一点,但名称与原始数据中的文件夹名称相同。 如何用我想要的名称更改它们?(还将播放的歌曲写入 TextView ) Here is
这很令人困惑,我已经阅读了 StackOverFlow 中的文档和其他一些问题。我只是不明白(或者答案不符合我的需要) 事情是这样的:我有一个 php,其中有两个来自 SQL 查询的值。到目前为止,一
我有一种设计模式,但我不确定如何创建它。它应该是这样的: 我仍在努力将 ImageView 放在卡片 View 前面。对此有任何想法或如何做到这一点的例子吗?谢谢! 这是我所做的:
我目前正在使用 Swift 编写游戏,但遇到了一些问题。基本上,我在 Storyboard中创建了所有 UI,并为每个屏幕(主菜单、设置、存储、播放等)提供了相应的 View Controller 。
在我的应用程序中,用户在 map 上绘制了一个形状并使用 UIBeizerPath 我正在绘制该路径。然后根据路径的坐标,我显示仅在该区域的结果。一切都很好,除了现在当注释落在 map View 上时
我有一个滑动 Pane 布局,左侧是一个 ListView ,右侧是一个包含我的 fragment 的 Pane 。当我单击 ListView 项时,我的 fragment 会正确加载到右侧 Pane
我有以下代码: public class MainActivity extends ActionBarActivity { EditText userfield; EditText p
我想把最后一列“描述”放到下一行 这是 fiddle http://jsfiddle.net/pratbhoir/fNhKp/12/ 应该是这样的我需要表格,描述td必须在同一个tr中。 Item n
我确定这很简单,但我似乎无法弄明白。我基本上是在尝试使用 C++ 生成 HTML 字符串并将其返回以存储在 Objective-C 模型类中,以便稍后在 Web View 中使用。 它的 C++ 端似
我正在使用 Mapbox SDK (SWIFT) 并创建了我的自定义 map 。我在 Storyboard的 map 上添加了一个按钮和图像,但是当我运行该应用程序时,它似乎隐藏在后面。我尝试了所有方
我有一个文本编辑器,其中有一个图像工具,它有一个插入功能,可以在左侧和右侧添加边距,但如果您想将图像移到父容器之外,则只有左边距有效,但右边距只是停在边缘容器 .draft-bg { paddin
我创建了一个可消耗的 COM 类库。 类库获取相机的图像。它的类型为图像/位图。 我在VB6中使用类库,我需要在VB6中显示这个图像。 如何将此 System.Drawing.Image 转换为 VB
我正在从 Ruby 转向 Objective-C,并且我一直在做: NSObject *foo; @property (nonatomic,retain) NSObject *foo; 在 .h 文件
我有一个项目需要 Android、iOS 和桌面模块来连接到 GAE 后端。 我通过 Android Studio 创建了后端,它工作正常。 据我了解,Android Studio 会生成端点类文件,
好吧,基本上我有一个带有一系列稍微重叠的 subview 的 View 。单击 subview 时,它会通过非常简单的两行代码移动到顶部(除其他外): -(void)mouseDown:(NSEven
在 sonarqube 服务器(版本 5.4)上,我为 C# 创建了一个新的质量配置文件,并且启用了一些规则,例如“CA1001:拥有一次性字段的类型应该是一次性的”。我已将此新配置文件定义为默认配置
Eclipse 有很多特性可以为开发者节省很多时间,例如: 1) 覆盖/实现方法... 2) TODO 列表... 3) 快速访问文档...(可能还有其他内容) 是否有任何适用于 VS 2010 的插
我是一名优秀的程序员,十分优秀!