how to remove git tracking from a project?
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
from my projects directory or is there a way to do this as a git command.
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
.
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.
From there, you can run git init
to create a fresh repository.
rm -rf .git
should suffice. That will blow away all git-related info.
It's not a clever choice to move all .git*
by hand, particularly when these .git
files are hidden in sub-folders just like my condition: when I installed Skeleton Zend 2 by composer+git, there are quite a number of .git
files created in folders and sub-folders.
I tried rm -rf .git
on my Github shell, but the shell can not recognize the parameter -rf
of Remove-Item.
www.montanaflynn.me introduces following shell command to remove all .git
files one time, recursively! it's working really!
find . | grep ".git/" | xargs rm -rf
链接地址: http://www.djcxy.com/p/26262.html
上一篇: GIT:签出到特定的文件夹
下一篇: 如何从项目中删除git跟踪?