Lea Hayes
Lea Hayes

Reputation: 64196

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"?

Upvotes: 6

Views: 959

Answers (2)

Andy
Andy

Reputation: 46324

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"

Upvotes: 9

Stefan Kendall
Stefan Kendall

Reputation: 67802

Remove the .git directory.

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

Upvotes: 3

Related Questions