How to merge all previous commits into a single commit?
Context: Started project on GitHub and have been experimenting with git commands. The history of the project is untidy.
Question: How can I remove all history and replace all commit messages with something along开发者_开发知识库 the lines of "Uploaded initial version of project source"?
This option will allow you to keep all your configuration files for the project
git reset --soft <sha_of_initial_commit>
git commit -a --amend -m "initial commit"
Remove the .git
directory.
git init
git add .
git commit -m "Initial commit"
git push origin master
精彩评论