gpt4 book ai didi

git - 如何恢复我在本地删除但尚未提交的文件?

转载 作者:太空狗 更新时间:2023-10-29 14:41:27 26 4
gpt4 key购买 nike

我有这种情况:

MacBook:Ja.git alan$ git status
On branch alan-1
Your branch is up to date with 'origin/alan-1'.

Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

deleted: Ja/Views/CardsTab/Xaml/Actions/QuizActions.xaml
deleted: Ja/Views/CardsTab/Xaml/Actions/QuizActions.xaml.cs

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: Ja/App/SetResourceColors.cs
modified: Ja/App/Styles.cs
modified: Ja/Templates/Button/Button.xaml.cs
modified: Ja/Views/CardsTab/CardsTab.xaml
modified: Ja/Views/CardsTab/Xaml/Actions/Actions.xaml

有什么方法可以恢复我刚刚删除的这些文件。不确定这是否有帮助,但来源仍然有这些文件的最新版本。

最佳答案

您可以按照提示信息开始尝试:

git reset HEAD -- Ja/Views/CardsTab/Xaml/Actions/QuizActions.xaml

这应该取消暂存删除并恢复文件:

git checkout -- Ja/Views/CardsTab/Xaml/Actions/QuizActions.xaml

正如 torek 所说,这可以一步完成:

git checkout HEAD -- Ja/Views/CardsTab/Xaml/Actions/QuizActions.xaml

关于git - 如何恢复我在本地删除但尚未提交的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54898667/

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