gpt4 book ai didi

linux - 如何使用 GIT 从远程获取所有已删除的本地文件

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:44:05 25 4
gpt4 key购买 nike

我有一个包含多个文件的本地目录。这些文件已经存储在远程 git (BitBucket) 中。

我不小心在本地删除了这些文件,怎么办从远程存储库取回它?

最佳答案

如果您已经在本地拥有这些文件,则无需从远程获取它们。

您可以使用:

git checkout -- <deleted file name>

您还可以使用文件和目录通配符:

git checkout -- dir1/*

git checkout [<tree-ish>] [--] <pathspec>...

Overwrite paths in the working tree by replacing with the contents in the index or in the <tree-ish> (most often a commit). When a <tree-ish> is given, the paths that match the <pathspec> are updated both in the index and in the working tree.

关于linux - 如何使用 GIT 从远程获取所有已删除的本地文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52511140/

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