How do I remove version tracking from a project cloned from git?

后端 未结 10 1219
太阳男子
太阳男子 2020-11-28 00:00

I want to remove all version tracking from a project\'s directory.

What is the correct method to do this?

Can I do a shell command such as:

r         


        
相关标签:
10条回答
  • 2020-11-28 00:43

    All the data Git uses for information 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 the Show hidden files, folders and disks option.

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

    0 讨论(0)
  • 2020-11-28 00:45

    Windows Command Prompt (cmd) User:

    You could delete '.git' recursively inside the source project folder using a single line command.

    FOR /F "tokens=*" %G IN ('DIR /B /AD /S *.git*') DO RMDIR /S /Q "%G"
    
    0 讨论(0)
  • 2020-11-28 00:46

    You can also remove all the git related stuff using one command. The .gitignore file will also be deleted with this one.

    rm -rf .git*
    
    0 讨论(0)
  • 2020-11-28 00:47

    In a Windows environment you can remove Git tracking from a project's directory by simply typing the below.

    rd .git /S/Q
    
    0 讨论(0)
提交回复
热议问题