xcodegitgithubgit-rebasegit-pull

How to git pull rebase when I have deleted files locally?


I'm working on an XCode project, and I want to push my local changes.

However, my local and remote branch had diverged before I made local changes, so I understand that I have to do a 'git pull and rebase local changes onto upstream changes'.
XCode instruction

This lets me resolve the conficts on XCode, except it cannot resolve files that I have deleted on purpose locally after my branch had diverged from origin/main. It has to pull first, but the local file it would pull remote changes onto doesn't exist. XCode screen

I have tried git pull --rebase origin main, then git rm for the deleted files and git add for other changes files in Terminal, but it doesn't let me get past git rebase --continue because there are conflicts with my commits to XCode. I want to stay away from having to do it on Terminal because it crashed the last time.

What should I do? Any comments would be greatly appreciated.


Solution

  • It is helpful to close Xcode when doing a rebase to avoid conflicts of deleted files and do the rebasing in Terminal. Rebasing and merging in main can change the project file structure, and Xcode isn't the most robust IDE.

    Once closed, in terminal you can chose to either delete or add the file that's mentioned in the conflict by doing git add/git rm to add or remove the file and then continue the rebase. (git rebase --continue after adding or removing). It sounds like in your description you already got this down, so I wonder if keeping Xcode open is messing with this file and doing the steps with it closed could help.