I am attempting to merge two branches, but I have four files with a "C" icon at the side of the file name, like the following:
No matter how I click the file, I cannot open it.
Meanwhile, the bottom right "Merge" button is inactive, and I am guessing that the cause for unable to select "Merge" is the icon beside the file name. Can anyone tell me what does that sign mean? And If resolving the problem with the "C" icon is enough to make the "Merge" button active so that I can merge two branches successfully?
After I click on the "C" file, and then click on some other files with A, there is a message says:
The source control operation failed because the file “XXX” could not be found. Make sure a valid file exists in the repository and try again.
I understand that I added some new files that the other branch does not have, so I guess this is the other cause for me not able to merge the two branches? However, I am confused that, if I were to fix the alert and the new file exists in the repository, doesn't it mean that I actually successfully "merge" the two branches, sine the old branch would then contain the new file? Could anyone provide any insight in this?
https://stackoverflow.com/a/20033446 helped me solve this. There was an untracked file causing the issue. The file was there on both tracks but somehow it wouldn't work.
What I did was the following:
Add the problematic file name to the .gitignore in both repos
Close Xcode
cd
into main branch
git rm -r --cached .
open the project, change a file and commit.
Exit Xcode to do git add .
Open Xcode and commit again, push
cd
into the problematic branch
git rm -r --cached .
open the project, change a file and commit.
Exit Xcode to do git add .
Open Xcode and commit again, now pull
Do a change, commit and push.
Now in your main, pull once again.
Both dir
s are now on the same state. Edit your .gitignore file to add the problematic file back in, push from this dir
and pull from the other dir
.
Now both have the same clean state with the problem file included.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With