fibono
fibono

Reputation: 783

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?

Thanks!

Upvotes: 2

Views: 65

Answers (2)

David Deutsch
David Deutsch

Reputation: 19025

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:

  1. Make a copy of your directory to, say, newdir
  2. Delete newdir/.git
  3. In newdir, type git init .
  4. 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.

Upvotes: 4

adao7000
adao7000

Reputation: 3670

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.

Upvotes: 1

Related Questions