如何将所有以前的提交合并为单个提交? [英] How to merge all previous commits into a single commit?

查看:111
本文介绍了如何将所有以前的提交合并为单个提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文:
在GitHub上启动项目并且一直在尝试使用git命令。该项目的历史是不整洁的。



问题:如何删除所有历史记录,并用已上传项目源的初始版本?

解决方案

此选项将允许您保留项目的所有配置文件

git reset --soft< sha_of_initial_commit>

git commit -a --amend -minitial提交


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"

这篇关于如何将所有以前的提交合并为单个提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆