Delete all Git Commit History

I am trying to fetch a repo from Github, revert a tag in past, push it to another remote with deleting all history. I can do everything with below except deleting all commit logs. What I am missing?

git clone https://github.com/user/user-repo.git
cd user-repo
git reset --hard tags/v2.0
git remote add stash ssh://git@myserver:7999/myproject/user-repo.git
git push --force stash master

  • create a new svn branch with git-svn
  • Git plumbing command to find out which files have been changed in a given revision
  • How do I code against one github repo on 2 computers?
  • npm git protocol dependencies
  • ssh config for multiple bitbucket accounts - Simple example, but getting 'remote end hung up unexpectedly'
  • git push heroku master permission denied on VISTA
  • What causes git's post-receive umask to be different from the user's umask?
  • git rev-parse --git-path hooks always return absolute path
  • Git merge flattening
  • Can't resolve rebase conflict
  • Cherry-picking from git to svn (or, How to keep a project history in git and releases in svn)
  • Find which commit does an object belong to?
  • 3 Solutions collect form web for “Delete all Git Commit History”

    I thought what you want is a repo like a new one, so deleting the .git/ directory and re-initing it will be more simple.

    git clone https://github.com/user/user-repo.git
    cd user-repo
    git reset --hard tags/v2.0
    
    rm -rf .git/
    git init
    git add .
    git commit -m 'first commit'
    
    git remote add stash ssh://git@myserver:7999/myproject/user-repo.git
    git push --force stash master
    

    You can use git merge --squash to squash all commits into one and then push it.

    Are you basically talking about rolling up all of the commits into one commit or do you want to retain all of the commits but truncate the actual commit message?

    To squash the commits into one (and truncate the final commit message, if you want), you can use an interactive rebase:

    git rebase -i <whatever>
    

    To truncate the actual commit messages but retain all of the commits, use the --msg-filter option to git filter-branch.

    Git Baby is a git and github fan, let's start git clone.