How to move files and folders using git in Xcode 4?

I am familiar with the differences between groups and actual directories in Xcode. I always create the actual folder in finder and drag it into the project, ensuring that "copy" is not checked.

When I move folders, I delete items only by reference, move them to finder, and then re-add them.

Now I am using git for the first time and found in my testing that if I delete the directory using the method described above, I cannot commit. Xcode tells me that it cannot switch to a directory because "there is no such file or directory." From what I found on the Internet, git is not notified of changes to the directory when this is done in Xcode.

How can I move files and folders using git in Xcode 4 and have a compiler and git know about movements so that I can commit?

+6
source share
2 answers

You do not have to move files to the GIT repository using Finder. You better use the move command from the shell.

Then you need to manually update the links in Xcode (or delete / add files again).

Moving a file is similar to the unix command 'mv' with the prefix 'git:

git mv path destination

(use -f to override the destination ... with caution)

+4
source

After making all changes to the Finder, open a terminal window and go to the project directory:

 cd path/to/project 

run the following command:

 git add --all 

This command will make all the changes, and Xcode will be able to resume managing this repository here.

+3
source

Source: https://habr.com/ru/post/907940/


All Articles