/ mozey.co / blog

removing git history

July 1, 2013

Setting up a new repos might involve lots of experimenting and backtracking. To clean the slate and do a proper initial commit it is useful to reset the git history.

cd /path/to/repos

Remove all version control info

rm -rf .git

Create a new repos

git add .
git commit -m "Initial commit"

Push it to an existing github repos, overwriting the history.

git remote add origin https://github.com/username/repos
git push -u --force origin master

After this commit and push changes as usual.