1

I am trying to merge my master branch into my multiple printer branch but it keeps getting stuck on Breakpoints_v2.xcbkptlist and .DS_Store files. I had to drop back to my master branch to fix a bug in production. multiple printer branch is the one I am working on for the next feature update. I wanted to merge the bug fix from the master branch into my multiple printer branch so those fixes are rolled into the next feature release along with the new code.

Anyone know how I can fix this error so the merge will go through? I am using the latest version of xCode 10.1 and MacOS 10.14.2

I have everything in sync I believe:

Robs-Mac-Pro:SA rhb$ git status

On branch multiplePrinters Your branch is up to date with 'origin/multiplePrinters'.

nothing to commit, working tree clean

Robs-Mac-Pro:SA rhb$ git status On branch master Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Robs-Mac-Pro:SA rhb$

But as soon as I try to merge those file re-appear with the error shown in the picture. I can't get past it!

Sorry, I am new to GIT.

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rob
  • 757
  • 1
  • 10
  • 26
  • 1
    Possible duplicate of [How to make Git "forget" about a file that was tracked but is now in .gitignore?](https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – matt Dec 13 '18 at 21:43
  • I have tried those solutions but continue to be unable to merge. From my terminal: I have everything in sync I believe: Robs-Mac-Pro:SA rhb$ git status On branch multiplePrinters Your branch is up to date with 'origin/multiplePrinters'. nothing to commit, working tree clean Robs-Mac-Pro:SA rhb$ git status On branch master Your branch is up to date with 'origin/master'. nothing to commit, working tree clean Robs-Mac-Pro:SA rhb$ But as soon as I try to merge those file re-appear with the error shown in the picture. I can't get past it! – Rob Dec 13 '18 at 22:36
  • Maybe Xcode is just confused at this point. I never use it in these situations, for just that reason. Did you do new commits on both branches after removing the troublesome files from the cache? If so, can you now do the merge from the command line? – matt Dec 13 '18 at 22:41
  • No I haven't. I am new to git and was working inside xcode primarily. I believe looking at the git on the web that those files are just missing in the master branch, but present in the multiple printer branch and that is way it won't merge. I'm not sure how to sync those two files (actually four files, 2 of each named above) so Xcode will let me merge. – Rob Dec 13 '18 at 23:28
  • Right, well, you need to get onto every branch that tracks these files, remove them from the cache, and commit. If you don't want to do that from the command line, use SourceTree. You won't be able to do it through Xcode. – matt Dec 13 '18 at 23:39

2 Answers2

0

(Edit / Disclaimer : I think matt is onto something just .gitignore, now that I reread your question, but even at this point it's unsure. Can you clarify if the "problem" is conflicts you don't know how to solve, and what is the desired target state?)

You don't give much details but the core principle is

# get on your feature branch, I'll assume it to be named as follows
git checkout multiplePrinters

# now we get the latest changes from master
# ( reminder: pull = fetch + merge )
# git pull master

At this point, conflicts may arise and it's not an error or some sort of hazard. Git asks you to choose how you want to merge conflicting versions.

Of course, checking the doc or some questions here might be useful.


(edit after your comment)

If you don't want to resolve conflicts on these problematic files, but rather take master version as is (but it would be the same for the other branch, this is just an example), you can start the merge as shown above, then

# get your xcbkptlist file from master
git checkout master -- path/to/Breakpoints_v2.xcbkptlist
# repeat for the other files (.DS_Store)
# then add them all and commit to finish the merge
git commit -a -m "Useful message here"
Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
  • Yes, I did as you described with the same result. Is there a way to retroactively ignore changes to those files before I try to merge. I added them to my ignore file but after the project was already started. – Rob Dec 13 '18 at 21:42
  • Xcode won't let me complete the merge, even after trying the other solutions and checking the git status which shows both the master and multiple printer are up to date. It keep choking on those two files and inside Xcode when I try to resolve the conflict I get the error in my picture with no option to resolve it - like ignore this file or change. – Rob Dec 13 '18 at 23:19
  • @Rob I'm unfortunately far too ignorant on Xcode and I guess it prevents me from getting the whole picture... :-/ I wish I could help more, sorry – Romain Valeri Dec 14 '18 at 00:05
0

but it keeps getting stuck on Breakpoints_v2.xcbkptlist and .DS_Store files.

But those files should not be tracked by git in the first place. Include them in your gitignore file.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • I have them in my gitignore file, but I added them after starting the project and they keep showing up. – Rob Dec 13 '18 at 21:40
  • Yes, the gitignore file doesn't magically stop something already being tracked from being tracked. You also need to `git rm --cached` those files. See https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore (and I think we now know enough to call this a duplicate of that, as well as of this sort thing https://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects). – matt Dec 13 '18 at 21:43
  • When I try that from the project directory I receive this from the terminal: fatal: pathspec 'Breakpoints_v2.xcbkptlist' did not match any files – Rob Dec 13 '18 at 21:46