git - 如何从项目中删除git跟踪? [英] git - how to remove git tracking from a project?

查看:293
本文介绍了git - 如何从项目中删除git跟踪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从项目目录中删除git跟踪。什么是正确的方法来做到这一点?我可以执行一个shell命令,例如:

I want to remove git tracking from a project's directory. What is the correct method to do this? Can I do a shell command such as:

rm -rf .git

来自我的工程目录,或者有办法做到这一点作为git命令。

from my projects directory or is there a way to do this as a git command.

I使用这个项目来学习git,并意识到我在项目的早期就发生了一些错误,包括移动,重命名和删除文件。我想删除所有的git跟踪,并使用 git init 来重新开始。

I used this project to learn git and realize I made some mistakes early on in the project with moved, renamed and deleted files. I'd like to remove all git tracking and start fresh with git init.

推荐答案

所有数据git使用信息存储在 .git / 中,所以删除它应该可以正常工作。当然,请确保您的工作副本处于您想要的确切状态,因为其他一切都将丢失。 .git 文件夹已隐藏,因此请确保您打开显示隐藏文件,文件夹和磁盘选项。

All the data git uses info is stored in .git/ , so removing it should work just fine. Of course, make sure that your working copy is in the exact state that you want it, because everything else will be lost. .git folder is hidden so make sure you turn on Show hidden files, folders and disks option.

从这里开始,你可以运行 git init 来创建一个新的仓库。

From there, you can run git init to create a fresh repository.

这篇关于git - 如何从项目中删除git跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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