问题
I'm just getting started with git, and started messing about with Bitbucket. However, I now want to use the repository I created, but without its initial history.
Is there any way I can clear out or purge my repository so that I can start from scratch?
I'm not too bothered about any of the content, so can I just delete the repository, then create a new one with the same name?
回答1:
No need to delete it.
From your new local repo, simply:
git push --force -u origin master
That will replace the history of your BitBucket master branch by the new one you have done locally.
Now, if you had pushed other branches before, you might want to delete them.
git push origin :oldBranch
来源:https://stackoverflow.com/questions/13669410/clear-git-repository-on-bitbucket