如何在 Android Studio 中更改 git 分支 [英] How to change git branch in Android Studio

查看:59
本文介绍了如何在 Android Studio 中更改 git 分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 gitlab 项目中有 2 个分支.现在我在主(默认)分支上.我想把它改成另一个基地,这是我试过的:

I have 2 branches in my gitlab project. Now I'm on the master (default) branch. I want to change it to another base, this is what I tried:

当我去VCS ->吉特->分支,然后点击Checkout tag or revision 我总是得到一个错误:

When I go to VCS -> Git -> Branches, and click Checkout tag or revision I always get an error :

pathspec 'my branch' 与 git 已知的任何文件都不匹配

pathspec 'my branch' did not match any files known to git

我该怎么办?我想要做的就是更改 branch 并执行 pull 请求.

What should I do? All I want to do is to change the branch and do a pull request.

推荐答案

要从 Android Studio 中检出不同的分支:

To checkout a different branch from within Android Studio:

VCS -> Git -> Branches 下,您将看到此屏幕

Under VCS -> Git -> Branches you will see this screen

本地分行下,您将看到可以结帐的本地分行.在最底部,您会看到当前签出的分支(在我的例子中是 master).要结帐不同的分支,请选择它并单击结帐.

under Local branches you will see the local branches you can checkout. At the very bottom you see the currently checked out branch (in my case master). To checkout a different branch, select it and click Checkout.

在我的示例中,我只有一个本地分支,名为 test.这就是为什么它只显示那个.

In my example I only have one other local branch, named test. That is why it only shows that one.

签出不同的分支后,会在屏幕底部弹出此窗口

After checking out a different branch, this window will pop up in the bottom of the screen

为了让您的远程分支显示在 Android Studio 中,您首先需要获取它们:

In order to get your remote branches to show up in Android Studio, you first need to fetch them:

VCS -> Git -> Fetch.之后就会出现

这篇关于如何在 Android Studio 中更改 git 分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆