Reputation: 1954
I did git stash
. I then did git stash pop
but got the following error:
error: Your local changes to the following files would be overwritten by merge: [proj].xcodeproj/project.xcworkspace/xcuserdata/[user].xcuserdatad/UserInterfaceState.xcuserstate Leaflet-[proj]/Leaflet.xcodeproj/xcuserdata/[user].xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist Please commit your changes or stash them before you merge. Aborting
I committed my changes. I tried git stash pop
again to no avail. I then removed the files with git rm --cached
and committed those deletions. git stash pop
now gives error: refusing to lose untracked file
.
git status:
Your branch is ahead of 'origin/temp' by 2 commits. (use "git push" to publish your local commits)
Unmerged paths: (use "git reset HEAD ..." to unstage) (use "git add/rm ..." as appropriate to mark resolution)
deleted by us:
[proj].xcodeproj/project.xcworkspace/xcuserdata/[user].xcuserdatad/UserInterfaceState.xcuserstate deleted by us:
[proj]/xcuserdata/[user].xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
Upvotes: 3
Views: 7608
Reputation: 6872
If you deleted files in your stash, then the stashed changes cannot be merged because it can't merge to non-existent files. It sounds like when you said you committed your changes earlier you might have done a git add
but not a git commit
? After doing a git commit
running git stash pop
should have worked. If you did do that and it didn't I'm not sure what the issue was because you haven't provided enough info at that point.
You have a few options now. The safest is probably to do a git stash branch <branchname>
. That will checkout your last stash onto a new branch. From there you can edit it as you like, commit your changes to the branch, then merge it back to the branch you were working on.
If you just want to discard your latest stash you can git stash drop
.
If you want to discard all stashes: git stash clear
.
Upvotes: 2