How to fully delete a git repository created with init?

前端 未结 13 1803
再見小時候
再見小時候 2020-11-22 16:42

I created a git repository with git init. I\'d like to delete it entirely and init a new one.

相关标签:
13条回答
  • 2020-11-22 17:20

    In windows:

    1. Press Start Button
    2. Search Resource Monitor
    3. Under CPU Tab -> type .git -> right click rundll32 and end process

    Now you can delete .git folder

    0 讨论(0)
  • 2020-11-22 17:21

    after cloning the repo

    cd /repo folder/
    

    to go to the file directory then

    ls -a
    

    to see all files hidden and unhidden

    .git .. .gitignore .etc
    

    if you like you can check the repo origin

    git remote -v
    

    now delete .git which contains everything about git

    rm -rf .git
    

    after deleting, you would discover that there is no git linked check remote again

    git remote -v
    

    now you can initial your with

    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/Leonuch/flex.git
    git push -u origin master
    
    0 讨论(0)
  • 2020-11-22 17:24

    To fully delete the .git repository in your computer (in Windows 8 and above):

    1. The .git repository is normally hidden in windows
    2. So you need to mark the "hidden items" to show the hidden folders
    3. At the top site of you directory you find "view" option
    4. Inside "view" option you find "hidden items" and mark it
    5. Then you see the .git repository then you can delete it
    0 讨论(0)
  • 2020-11-22 17:24

    true,like mine was stored in USERS,so had to open USERS go to View on you upper left find Options,open it and edit folders'view options in view still to display hidden files/folders,all your folders will be displayed and you can deleted the repo manually,remember to hide the files/folders once done with the delete.

    0 讨论(0)
  • 2020-11-22 17:30

    Windows cmd prompt: (You could try the below command directly in windows cmd if you are not comfortable with grep, rm -rf, find, xargs etc., commands in git bash )

    Delete .git recursively inside the project folder by the following command in cmd:

    FOR /F "tokens=*" %G IN ('DIR /B /AD /S .git') DO RMDIR /S /Q "%G"

    0 讨论(0)
  • 2020-11-22 17:33

    I tried:

    rm -rf .git and also

    Git keeps all of its files in the .git directory. Just remove that one and init again.

    Neither worked for me. Here's what did:

    • Delete all files except for .git
    • git add . -A
    • git commit -m "deleted entire project"
    • git push

    Then create / restore the project from backup:

    • Create new project files (or copy paste a backup)
    • git add . -A
    • git commit -m "recreated project"
    • git push
    0 讨论(0)
提交回复
热议问题