Switching branch on Xcode 9 - xcode

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 8

Press ⌘2 to open the new Source Control Navigator.
Right-click on the master icon.
To switch to a different branch
Right-click on a non-current branch
Choose Checkout...
Press ↩ or click on the Checkout button.

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):
Now select the second tab:
Right click on the branch you are intending to checkout and hit the checkout button from menu:

It seems that Apple has moved Source Controls feature like change branch, version history to separate tab in Navigator area for Xcode 9.x
Below are step to perform branch switch :
Open the Navigator area (if it is hidden) by pressing left pane window present on top right of Xcode or use shortcut cmd + 2
In Source control navigator you can see Branches, Tag present for your project.
Now, if you want to switch branch then select the branch to switch and right click on it.
Select Checkout. This will prompt an alert Do you want to check out “<branch name>”? Select Checkout.
Now this will switch your branch to selected one after sometime.
Note: In order to switch between branches you need to commit or discard changes done in project.
You can even see Log history by selecting branch. Commit history can be viewed based on last 24 hours, last 7 days and last 30 days.

1) Press show navigator button (top right corner of Xcode):
2) Show the project navigator, expand Remotes folder:
3) Expand the origin folder, right click the branch you want to use, and click Checkout....

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

Related

How to Git Blame/Authors a previous revision with Xcode 11?

With Xcode 10.2, I could select the "Authors" view, then select a previous git revision to blame from the bottom picker:
But with Xcode 11 beta, when I select the "Authors" view, I'm unable to select a past revision to blame because the picker is missing:
Was that feature removed, or are there new steps to do to blame the lines of code for a past revision? To illustrate it even more, I'd like to see in Xcode 11 a past Blame like GitHub does when you blame a specific previous revision.
It has been moved here
It has been moved here
for a git blame version click Editor->Author as it, sure it moved
you can select the icon located in top-right of Xcode to find a previous revision
Select the icon in the window title bar to enter "Code Review" mode.
git log (History) is available at Cmd-Alt-2. There you can open a specific commit in code review mode via the context menu.
Mine wasn't showing up until I went to Editor > Show Last Change For Line. After I selected that, the 'Authors' row appeared in Editor > Authors, as well as in the 'Adjust Editor Options' icon in the top right of the page.
Answer to the original question:
You can't. Since Xcode 11, you can only git-blame your working copy. Note: This is my suggested answer after a lot of trying and googling. I'd be happy to learn the opposite.
Further information:
Many people, including me, seem to land on this page because they don't find the git-blame feature AT ALL in Xcode 11.
In Xcode < 10, the version editor came in three flavors: 1) Comparison view (=side-by-side diff), 2) Author (=git-blame) 3) Log. In all three flavors, you could choose a specific revision to look at.
In Xcode >= 11, the version editor (now called “Code Review”) only encompasses the comparison view (=side-by-side diff). The Code Review mode is toggled on/off with the double arrow button in the tool bar.
The Authors view (a.k.a. git-blame) is now a side-pane of the normal editor and can be toggled on/off in the Editor main menu. THIS OPTION IS NOT AVAILABLE WHEN YOU ARE IN CODE REVIEW MODE! For me, this caused confusion when looking for the Authors view.
The fact that the Authors view is not part of the version editor might be the reason that we cannot choose to look at arbitrary revisions. I have filed a suggestion with Apple to re-enable this feature. You should consider to do the same to give the issue more visibility.
In Xcode 11, the previous "Authors" menu item doesn't appear by default in the menu set. The simplest way to make it appear is to press the default key bind shift+control+command+A. After that, you'll find that "Minimap", "Authors", and "Code Coverage" now appear in the "Editors" menu.
If you go up to the top of Xcode, go to "View" and tap on "Show code review", you'll be able to get the git history with author information like on older versions of Xcode.

Do not show pull window TortoiseGit

I do need to pull a lot, and now I need to click Git Pull, click OK and then it pulls. Is there an option to skip this window? I never change the pull options so it has no use for me.
I've searched the settings but I can't find it anywhere..
Using TortoiseGit 1.8.15.0
Perhaps using Git Synchronization dialog.
Right click on you repo and click context menu item Git Sync....
Show you:
Then, keep this dialog opened.
If that button does not present Pull for you, using the drop menu to select Pull.

Is there a better way to see which Git branch I am on in the XCode 7 Interface?

I'd like to be able to see which Git branch I am currently working on at a glance in the XCode 7 (beta 5) interface without going through the menu system. Is this possible? I want to see the equivalent of running git branch from the command line which adds a star next to the current branch.
There are other questions which ask the question for earlier versions of XCode and I'd like to know if anything has changed or if anyone has any cleaver workarounds / solutions.
The only place I can see it is in the Source Control Menu after the project name:
Its also in the File Inspector in the Source Control Section which I can quickly show/hide using keyboard shortcuts but it would be nicer if I could see it as it is displayed in the Version Editor but without having to switch to the version editor:
Hi Codecowboy yes in Xcode 12.3 if you click on the so-called source code navigator (blue) x in the left menu panel header icon bar you should see the name of the project and the associated branch :-)

XCode source control: view changes for one file

Is it possible to view a "timeline" (history) for a selected file for like 50 commits? I mean changes made to this particular file and and view commits when they were made and users who changed them? I know Xcode got some powerful version control features, I just can not find this one.
What it sounds like you want is the "Blame View", if we were on the terminal you could write git blame <file-name> to see the commit/time/and user for every single line of a particular file. In Xcode you can accomplish the same thing by activating the blame view. I've posted a picture to show you where the Blame View button resides. From there you should be all set.
For xcode 11.0, If you select a file, changes for that file is available on right panel.
The commit history is in the Version Editor.
Select the file for which you want to see the commit history. Then go to View > Version Editor > Show Version Editor (or just select the Comparison view from the top-right toolbar icon - same place as the Blame view).
Clicking on the commit label below the editor will reveal the history including dates.
Yes. Xcode's Comparison view is exactly for that. When you select a source file, and choose comparison view, you have a time-machine like user-interface that besides letting you compare any two versions of the file, will also present (when you hover) all the commits of the file with their descriptions. This UI opens when you click the clock button in the bottom between the two versions of the .
Pay attention, that Xcode will list all the commits, but will fail to show the content of versions of the file if the file-name or path changed. I think Xcode makers thought that because sources are considered "different" if they are named differently or located differently, there's no point in showing them. It may be, though that they just overlooked the --follow parameter to git.
Xcode 13
Enable Code Review (default: cmd+shift+opt+Enter to toggle)
On the right of the bottom bar (or if you have the debug area opened: the bar that sits on top of it) there are a couple of buttons used for comparing commits: clicking them allows you to pick which commits to use for the comparison on the current file.
Enable Code Review button
Comparison buttons on Debug Area

Is there a way to detach a project from CVS in Xcode?

XCode's CVS support is abysmally bad. Or maybe it's just the server in my organization. Either way, it's leading to more headaches than it's worth so I'd like to "detatch" the project as I can in Eclipse. Is there an easy way to do this or do I have to manually delete all of the CVS files?
You have two choices.
Double click on your project in the main source list to bring up the "Project "myProject" Info" window. Make sure the "General" tab is selected. At the bottom of that tab select "None" from the "SCM Repository" popup menu and close the window.
Or, go to Xcode Preferences window and select the "SCM" tool, select the repository you want to remove, and then remove the repository using the "-" button in the lower left hand corner of the dialog box. This option is a bit more drastic.
These should both leave all of the invisible CVS directories alone. This will allow you to manage the repository from the command line and completely hide the CVS info from Xcode.
Good Luck.

Resources