Copy a git repo without history


I have a private repository on GitHub that I want to make public. However, some of the initial commits contain information that I don't want to publicize (hard-coded credentials, etc).

What is the easiest route to make the latest commit public (I don't really need or want the previous commits in the public repository) without including some or all of the commit history?


You can limit the depth of the history while cloning:

--depth <depth>
Create a shallow clone with a history truncated to the specified 
number of revisions.

Use this if you want limited history, but still some.

Best practices for adding .gitignore file for Python projects? [closed]

How do I name and retrieve a Git stash by name?