在 Xcode 9 上切换分支

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44396681/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 18:26:42  来源:igfitidea点击:

Switching branch on Xcode 9

xcodegitmacosversion-controlxcode9-beta

提问by Alexander MacLeod

I am having trouble finding the menu item to switch branch using Xcode 9. The working copies menu seems to have disappeared. Any ideas?

我无法找到使用 Xcode 9 切换分支的菜单项。工作副本菜单似乎已经消失。有任何想法吗?

Xcode 9

Xcode 9

enter image description here

在此处输入图片说明

Xcode 8

Xcode 8

enter image description here

在此处输入图片说明

回答by vadian

  • Press ?2to open the new Source Control Navigator.
  • Right-click on the mastericon.
  • ?2打开新的源代码管理导航器。
  • 右键单击该master图标。

enter image description here

在此处输入图片说明

To switch to a different branch

切换到不同的分支

  • Right-click on a non-current branch
  • Choose Checkout...
  • Press ?or click on the Checkoutbutton.
  • 右键单击非当前分支
  • 选择 Checkout...
  • 按下?或单击Checkout按钮。

enter image description here

在此处输入图片说明

回答by Rushabh

Expose the left side window (Navigator) in your Xcode by selecting this option (you will see this on the top right side of your Xcode window):

通过选择此选项在 Xcode 中显示左侧窗口(导航器)(您将在 Xcode 窗口的右上角看到它):

Enabling the Navigator

启用导航器

Now select the second tab:

现在选择第二个选项卡:

Selecting the Source control tab

选择源代码管理选项卡

Right click on the branch you are intending to checkout and hit the checkout button from menu: Checking out the branch

右键单击您要结帐的分支,然后从菜单中点击结帐按钮: 检查分支

回答by Jayprakash Dubey

It seems that Apple has moved Source Controlsfeature like change branch, version historyto separate tab in Navigator areafor Xcode 9.x

似乎 Apple 已经将Source Controls功能如change branch,version history移到Xcode 9.x 的导航器区域中的单独选项卡

Below are step to perform branch switch :

以下是执行分支切换的步骤:

  1. Open the Navigator area(if it is hidden) by pressing left pane window present on top right of Xcode or use shortcut cmd + 2
  1. Navigator area通过按 Xcode 右上角的左窗格窗口打开(如果它是隐藏的)或使用快捷方式cmd + 2

step1

第1步

  1. In Source control navigatoryou can see Branches, Tagpresent for your project.
  1. Source control navigator你可以看到BranchesTag为你的项目呈现。

Step2

第2步

  1. Now, if you want to switch branch then select the branch to switchand right clickon it.

  2. Select Checkout. This will prompt an alert Do you want to check out “<branch name>”?Select Checkout.

  1. 现在,如果要切换分支,请选择要切换的分支并右键单击它。

  2. 选择结帐。这将提示一个警报Do you want to check out “<branch name>”?Select Checkout

Step3-4

步骤 3-4

  1. Now this will switch your branch to selected one after sometime.
  1. 现在这将在一段时间后将您的分支切换到选定的分支。

Note: In order to switch between branches you need to commit or discard changes done in project.

注意:为了在分支之间切换,您需要提交或放弃在项目中所做的更改。

Step5

第五步

Step6

第六步

  1. You can even see Log historyby selecting branch. Commit history can be viewed based on last 24 hours, last 7 days and last 30 days.
  1. 您甚至可以通过选择分支来查看日志历史记录。可以根据过去 24 小时、过去 7 天和过去 30 天查看提交历史记录。

Step 6

第 6 步

Step 7

第 7 步

回答by Josh O'Connor

1) Press show navigator button (top right corner of Xcode):

1)按显示导航按钮(Xcode的右上角):

enter image description here

在此处输入图片说明

2) Show the project navigator, expand Remotesfolder:
enter image description here

2)显示项目导航器,展开Remotes文件夹:
在此处输入图片说明

3) Expand the origin folder, right click the branch you want to use, and click Checkout....
enter image description here

3) 展开origin文件夹,右击要使用的分支,点击Checkout...
在此处输入图片说明

回答by Teja Kumar Bethina

Follow the below link for the clear explanation of each and every functionality like, Commit, pull, push, etc.

按照下面的链接清晰地解释每个功能,如提交、拉取、推送等。

https://www.raywenderlich.com/153084/use-git-source-control-xcode-9

https://www.raywenderlich.com/153084/use-git-source-control-xcode-9