How to combine all previous commits into a single commit?

Context: Started a project on GitHub and experimented with git commands. The history of the project is untidy.

Question: How to delete the entire history and replace all commit messages with something like the lines "Loaded source version of the project source"?

+4
source share
2 answers

This option allows you to save all configuration files for the project.
git reset --soft <sha_of_initial_commit>
git commit -a --amend -m "initial commit"

+4
source

Delete the .git directory.

git init
git add .
git commit -m "Initial commit"
git push origin master

+2
source

All Articles