开发者

How to merge all previous commits into a single commit?

开发者 https://www.devze.com 2023-04-05 12:31 出处:网络
Context: Started project on GitHub and have been experimenting with git commands. The history of the project is untidy.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号