Reputation: 411
I'll try to piece what's been going of over the past few days. And note, I'm the only one working on this project. I keep track of all my issues/Todos in GitHub. I have a lot of feature branches, some stale and will never be merged up, but I keep around for reference.
It started when I tried merging develop
into master
. There was an odd merge conflict. I had added a new file to the project, worked on that file, then renamed that file. I made a commit to develop
and pushed that to GitHub. I wouldn't have expected a merge conflict because of this but that is what happened.
I always check/preview for merge conflict in GitHub before carrying out the merge in Xcode.
In GitHub, I checked for conflicts by comparing Master
<- Develop
. GitHub reported there was a conflict, so I made a pull request in GitHub in order to investigate.
The conflict was in a file called PlannerNote.xcodeproj/project.pbxproj
that looked something like (no longer can see the conflict):
<<<<<< Develop
3D1A5668256AC9B700AB319C /* AppearanceTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D1A5667256AC9B700AB319C /* AppearanceTableViewController.swift */; };
==========
>>>>>>> Master
What's odd is that there isn't a conflicting line in the master
branch. After all, this file was added as part of a new feature.
As per my usual workflow of trying to do all git actions within Xcode b/c it seems weird stuff happens if I use the git cli. So, my plan at this point was to attempt the merge via xcode and then fix the conflict in Xcode. That's what I did. I wound up in a file compare where the conflict was highlighted. What was odd is that both sides of the compare displayed the exact same code.I was given the choice to select left or right and, I believe, I selected left. As a side note, I could even tell by looking at the gui which file belong to which branch.
At any rate the conflict seemed to be reconciled and the merge went through. At this point, I'm on the master
branch and I pushed to GitHub. I then made a change to master
where I bumped the version number (I always do version bumps on master for whatever reason) and committed and pushed.
Now the real weirdness begins.
First, in GitHub for the master
branch it seems as if my whole .gitignore
file was, well, ignored. Every file within my project was added and pushed. Project generated files that don't need to be tracked, all pod
files where added as well as my entire fastlane
directory added and who knows what else. All of this should have been ignored. I'm using this .gitignore
Second, back in Xcode I tried switch back to develop
and got this:
I can't remember the exact steps found on stackoverflow that seemed to solve this but it went something like, delete DerivedData
and xcuserdata
and also has some varient of git reset ...
I then was confronted with this which I solved by slinging various stackoverflow suggestion to the wall and seeing what stuck:
So now I can change from master
to develop
. But I can't change back to 'master` when no changes have been made. I get the following warning:
From the terminal git status
shows:
Pods/
should be ignored.
Podfile.log
should have been added and tracked long ago.
I'm not really sure about PlannerNote.xcworkspace/
master
.I have no idea what to do. Development is at a stand still and every time I think I'm back up and running, I stumble on something new that stops me in my tracks
These next 2 screen shots show the directories/differences between master
and develop
. Note all the folder/files added in Master
. Not sure how that happened. It also makes me hesitant to update develop
from master
without cleaning up master
first.
I've also tried the solutions found here
Upvotes: 3
Views: 1474
Reputation: 36317
I've been in similar situations before. The best thing to do at this point is try not to spend too much time on figuring out the git issue. It's a bit hard to help this way. Your problem can't exactly be narrowed down remotely.
I'd recommend you go with this approach:
Check your current branch bad master
or last develop commit
. Go back to a stable master branch.
Then try to do pull request into master. See the comparison. Just go to GitHub and copy/paste manually the changes into new files or existing files. Hit ctrl+I
to fix any indentation issues.
Just ignore the cocoapod changes because a pod install
would just bring back those parts. No need to copy/past those
Make small commits. Make sure if you add a new file, then you commit the project file changes as well.
Also learn for future not now learn how to use git mergetool
when you have conflicts. Make sure it's set to use Xcode's built-in merge conflict resolver ie it's set to use FileMerge. See here and here. It's a super simple tool to use. You said: "As a side note, I could even tell by looking at the gui which file belong to which branch." Left is your current branch. Right is the branch you're merging in. most common example, left is your develop branch, right is your master branch.
Upvotes: 1