Git Clone, Delete the GitHub Repo, create new repo–>still have commit history?
I’m a newbie to git, and was hoping to delete a particular GitHub repository (from public view purposes). However, I’d like to keep a “copy” on my local computer with all its previous commits. If I git clone the repo, delete the repo on GitHub, then create a new repo, and finally push the local cloned project to the new repo, will the new repo have my commit history? Is this because the commit history is “stored” in my local project?
2 Solutions collect form web for “Git Clone, Delete the GitHub Repo, create new repo–>still have commit history?”
Yes, it will still have the history, as the entire repo (which includes the history) is pushed.
If you want to create a version of the repo without the history, do the following:
- Make a copy of your directory to, say, newdir
- Delete newdir/.git
- In newdir, type
git init .
- Still in newdir, type
git add .
Now newdir will contain a repo with just a single commit, which contains the latest from your repository, and you can push that.
Yes, the new repo will still have your commit history. When you “clone” a repo, you are cloning ALL aspects of it, which include commit history.