简体   繁体   中英

Git share subset of files from repo, retain no info on other files that were in repo

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.

.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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM