I wanted clone repository from github. It had lot of history, So i wanted clone without any history.
Is it possible to clone git repository without history?
Cloning an entire repo is standard operating procedure using Git. Each clone usually includes everything in a repository. That means when you clone, you get not only the files, but every revision of every file ever committed, plus the history of each commit.
If you commit sensitive data, such as a password or SSH key into a Git repository, you can remove it from the history. To entirely remove unwanted files from a repository's history you can use either the git filter-repo tool or the BFG Repo-Cleaner open source tool.
An empty repository contains no files. It's often made if you don't initialize the repository with a README when creating it. On GitHub.com, navigate to the main page of the repository. To clone your repository using the command line using HTTPS, under "Quick setup", click .
You can get a shallow clone using the --depth
option with value 1
git clone --depth 1 reponame.git
If you want more commit history, increase the value to meet your needs as required.
After cloned, you can delete the .git
directory, then re-init the git to generate a totally new repo.
$ git clone ... $ cd path/to/repo $ rm -rf .git $ git init
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With