git error you need to resolve your current index first

Viewed 21
% git checkout branch02_vr

M r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate M r2nr/r2nr.xcodeproj/xcuserdata/vhrao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist M r2nr/r2nr/Base.lproj/Main.storyboard Switched to branch 'branch02_vr'

on my branch branch02_vr:

% git add *.*
% git commit -m "message"
% git push -u origin branch02_vr
% git status

On branch branch02_vr Your branch is up to date with 'origin/branch02_vr'. nothing to commit, working tree clean Successful so far.

Then I wanted to merge my branch02_vr into main

 % git checkout main
% git merge branch02_vr

Updating dd5bfe5..0284d6d error: Your local changes to the following files would be overwritten by merge: r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate Please commit your changes or stash them before you merge. Aborting

% git commit -m "message"

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

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate

no changes added to commit (use "git add" and/or "git commit -a")

I dont understand the error here. So I just follow git prompts to fix the issue

% git add r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate % git merge branch02_vr error: Your local changes to the following files would be overwritten by merge: r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate

% git stash
% git merge branch02_vr

Looks like this worked. I go to remote main and verify the code changes are merged from brnach02_vr into main

% git stash pop

warning: Cannot merge binary files: r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate (Updated upstream vs. Stashed changes) Auto-merging r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate CONFLICT (content): Merge conflict in r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate On branch main Your branch is ahead of 'origin/main' by 1 commit. (use "git push" to publish your local commits)

Unmerged paths: (use "git restore --staged ..." to unstage) (use "git add ..." to mark resolution) both modified: r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate

no changes added to commit (use "git add" and/or "git commit -a") The stash entry is kept in case you need it again.

I dont understand what is going on with xcuserstate file

% git checkout branch02_vr

r2nr/r2nr.xcodeproj/project.xcworkspace/xcuserdata/vhrao.xcuserdatad/UserInterfaceState.xcuserstate: needs merge error: you need to resolve your current index first

I don't understand what is going on with the xcuserstate and the errors that are coming from it. I am working in a team and do not want to mess up others files. I cannot checkout my branch02_vr again. Can someone explain and help?

0 Answers
Related