gpt4 book ai didi

git - 删除在 git stash 中跟踪的文件,然后 git stash pop

转载 作者:行者123 更新时间:2023-12-05 05:16:54 36 4
gpt4 key购买 nike

我做了 git stash。然后我执行了 git stash pop 但出现了以下错误:

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

我提交了更改。我再次尝试 git stash pop 无济于事。然后我使用 git rm --cached 删除了文件并提交了这些删除。 git stash pop 现在给出 error: refusing to lose untracked file

git 状态:

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

最佳答案

如果您删除了存储中的文件,则无法 merge 存储的更改,因为它无法 merge 到不存在的文件。听起来当你说你早些时候提交了你的更改时你可能已经做了 git add但不是 git commit ?在做了 git commit 之后运行 git stash pop应该工作。如果您确实这样做了但没有这样做,我不确定问题出在哪里,因为您当时没有提供足够的信息。

您现在有几个选择。最安全的可能是做一个 git stash branch <branchname> .这会将你最后的存储 checkout 到一个新的分支上。从那里您可以根据需要对其进行编辑,将您的更改提交到分支,然后将其 merge 回您正在处理的分支。

如果你只是想丢弃你最近的藏品,你可以git stash drop .

如果你想丢弃所有的存储:git stash clear .

关于git - 删除在 git stash 中跟踪的文件,然后 git stash pop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49930954/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com