How do I remove all traces of Git for my repository?

15,142

Solution 1

Simply remove the .git directories inside and you're done.

Solution 2

This worked for me:

find . -name .git -print0 | xargs -0 rm -rf

Solution 3

I would wildcard that .git

find . -name "*.git*" -print0 | xargs -0 rm -rf;
Share:
15,142
TIMEX
Author by

TIMEX

Updated on June 07, 2022

Comments

  • TIMEX
    TIMEX almost 2 years

    I have a repository. ("git init")

    I've done check-ins and commits and logs and stuff. But, how can I remove all traces of git and delete git off this directory (and subdirectories)?

    I'm on Ubuntu.

  • MarkD
    MarkD almost 13 years
    Also look for .gitignore files in subdirectories, which are not part of the repository.
  • gsamaras
    gsamaras over 7 years
    ..and for me, thank you Steve! You can run git status afterwards to verify that the directory will not be a git directory afterwards...
  • Victor Ude
    Victor Ude over 6 years
    This removes .gitignore. Unless you mean to do that I'd say this is not a recommended approach.