clear git commit history to clean codes

Let’s imagine, one day you found out that the git repository of your project getting larger and larger, it’s hard to tolerance with ,and many commits were and will never be used ,so you decide to covert the current state to an initiate commit of the whole repository. Let’s just do the following.
1、 clear the whole history with : rm -rf .git
2、 reconstruct a repository : git init
3、 commit the initial commit: git add . && git commit -m ‘Initial commit’
4、 if you want to push it to your github:
git remote add origin git://xxxx
git push –force origin master -u

发表评论

电子邮件地址不会被公开。 必填项已用*标注