4

I am trying to figure out how to correctly rename files with git while using Xcode.

I made a test project, with a few commits, then renamed a file in Xcode, verified that the git status did say it was being renamed, and then committed outside of Xcode. This was in accordance with this answer to a SO question (Handling file renames in git).

I go back in to Xcode, try to look into the history of that file before the name change (in the version editor assistant window), and I get the error "This file does not exist in the index." While that is true, the file did not exist at that point, its predecessor did. When I go to the terminal, and run git log --follow myFile.m, I do see all commits, even those before the rename. So with that, the history is there, but Xcode doesn't seem to know how to find it.

How can you follow before a rename of a file in git version control when using Xcode?

PS. It does seem that the blame functionality can see before the name change, but the version editor can not.

Community
  • 1
  • 1
NickH
  • 683
  • 1
  • 5
  • 24
  • 1
    I don't think you can do it. The git GUI capabilities of Xcode are very crude. I almost never use them. You might submit this as a feature request (using Apple's bug reporter). But personally I prefer the command line, or SourceTree. – matt Apr 21 '14 at 01:14
  • Also, note that it is not difficult to confuse git itself in such a way that even `git log --follow` does not work after a rename. It's a weakness. – matt Apr 21 '14 at 01:17

1 Answers1

0

I had the same error today and as suggested by matt the best solution is to use an alternate Git GUI.

I finally solved this by installing the great GitX app by rowanj.

Then i saw the uncommitted change and simply commit it.

TY Xcode for being too git-simple and renaming-painful !

Community
  • 1
  • 1
fencingCode
  • 1,427
  • 10
  • 13