gpt4 book ai didi

git - 如何从github的存储库中删除文件夹?

转载 作者:行者123 更新时间:2023-12-04 15:51:30 26 4
gpt4 key购买 nike

我想从 GitHub 的存储库中删除一个文件夹,我将其推送为尝试一些 git 命令,但现在我无法删除它,我尝试使用 git rm -r --cached 文件夹名称和git 告诉我它不匹配任何文件。我的目标是保留本地文件夹并仅从 git 中删除它。感谢您的帮助!

最佳答案

注意:自 2021 年 1 月起,您还可以 delete that folder directly on GitHub .

从网络中删除目录

您现在可以从网络浏览器中删除整个文件目录,包括子目录:

  • Browse to the directory in the repository and branch that you want to delete
  • In the top-right corner, click "", and then Delete directory
  • Review the list of files
  • Depending on your permissions and the branch protection rules, choose to either commit the change directly or propose the change using a pull request

Learn more about deleting a file or directory.

https://docs.github.com/assets/images/help/repository/delete-directory-button.png

然后你可以获取,然后恢复/更新你的本地分支,without deleting the (now) deleted remote files

git fetch
git read-tree origin/main
git checkout-index -f -a
git update-index -q --refresh

关于git - 如何从github的存储库中删除文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53610000/

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