维护一个 git 项目, 发现里面的 commit 描述都是,修改某某文件,增加某某文件,有没有办法把这些 commit 删除呢?
比方说: 1 代表的是有效的 commit ,注释清楚 0 代表注释不清晰的 commit
1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1
我要如何把注释不清楚的 commit 删掉呢?
The main question is not "delete", but "merge".
git rebase -i <commit hash>
pick
squash
Suggestion git checkout -b squash_some_commits Create a temporary branch to handle this matter. If you make a mistake, delete it and start over.
git checkout -b squash_some_commits
git rebase 命令http://zhidao.baidu.com/link?url=Q8DXAl3eVJpkBKF9hcmCi0TlKC0Vyu47PuIkfBWviAoACV6wk67ahzJDXPgxsTpJtyz5euQzqTVu_95QAnN9xLazCzMPsC9gBwFT3RifXYO
git rebase
http://zhidao.baidu.com/link?url=Q8DXAl3eVJpkBKF9hcmCi0TlKC0Vyu47PuIkfBWviAoACV6wk67ahzJDXPgxsTpJtyz5euQzqTVu_95QAnN9xLazCzMPsC9gBwFT3RifXYO
The main question is not "delete", but "merge".
git rebase -i <commit hash>
Start from a certain commitpick
修改为squash
before the commits that need to be mergedSuggestion
git checkout -b squash_some_commits
Create a temporary branch to handle this matter. If you make a mistake, delete it and start over.git rebase
命令http://zhidao.baidu.com/link?url=Q8DXAl3eVJpkBKF9hcmCi0TlKC0Vyu47PuIkfBWviAoACV6wk67ahzJDXPgxsTpJtyz5euQzqTVu_95QAnN9xLazCzMPsC9gBwFT3RifXYO