如何从目录中删除git存储库而不删除其中的任何内容? [英] How to remove a git repository from a directory without deleting anything from it?

查看:75
本文介绍了如何从目录中删除git存储库而不删除其中的任何内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意外地使用git init将Desktop目录初始化为本地git存储库,如何在不删除同一目录中任何项目的情况下将其取消声明为普通目录.

I accidently initialized my Desktop directory as a local git repository using git init, how can I undeclare it to a normal directory without deleting any items in the same.

推荐答案

Git使用.git目录存储存储库历史记录及其元数据-Git尝试从任何目录中找到当前目录上方的.git目录(默认情况下,它在安装点停止)以确定当前目录是否为工作树.

Git uses a .git directory to store the repository history and its meta data - from any directory Git tries to find a .git directory above the current directory (by default it stops at mount points) to determine whether the current directory is a working tree.

只需删除桌面上的.git目录(该目录可能会以点号开头而被隐藏;您可以使用ls -la在控制台中将其列出,然后使用rm -rf .git将其删除).

Just remove the .git directory on your desktop (the directory might be hidden as it starts with a dot; you can list it in a console using ls -la and remove it using rm -rf .git).

这篇关于如何从目录中删除git存储库而不删除其中的任何内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆