0

I am trying to share some code that was previously in a git repository, but I simply want to just share the files. So, I copied and pasted the files to a new directory with no .git file. If I try rm -r .git, it says no such file.

However, when I run git log, I see the full log from the previous repo, which makes me wonder, what else is in there? Some of the files that were previously in that repo are sensitive, and I do not want to share them, so I wanted to remove anything that might be linked to them. Eg, if git log still works, I wonder if somehow someone could check out one of the old files, sensitive files? Just trying to be extra careful.

In other words, git is kind of a black box to me; I am not sure what information it has stored regarding old files in the repo. Now I just want to share a subset of these files, but some of the git commands still work, so I am paranoid that somehow I will accidentally share info from the old files. How does one go about completely removing everything? I tried git init, so now it has overwritten the log, but not sure if that's failsafe.

Sam Weisenthal
  • 2,791
  • 9
  • 28
  • 66
  • [Running git init in an existing repository is safe. It will not overwrite things that are already there.](https://stackoverflow.com/a/5149861/7976758). Found in https://stackoverflow.com/search?q=%5Bgit%5D+init+existing – phd Nov 30 '18 at 19:29

1 Answers1

0

.git is at the root directory and what ever is under the root is tracked by git.

Copy your subset of file to completely a new directory.

Following is one easy way to see which place is "safe".

run git status and cd .. commands until you see fatal: not a git repository (or any of the parent directories): .git error.

Create a temp directory there and copy your subset of files.

Just to test, run git status in that temp directory and you should get fatal: not a git repository (or any of the parent directories): .git.

Mohana Rao
  • 881
  • 5
  • 19