git 删除中间的 commit
过去多啦不再A梦
过去多啦不再A梦 2017-05-02 09:19:49
0
2
598

维护一个 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 删掉呢?

过去多啦不再A梦
过去多啦不再A梦

reply all(2)
刘奇

The main question is not "delete", but "merge".

  1. git rebase -i <commit hash>Start from a certain commit
  2. In the open editor, place pick 修改为 squash before the commits that need to be merged
  3. Save and exit

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 rebase 命令
http://zhidao.baidu.com/link?url=Q8DXAl3eVJpkBKF9hcmCi0TlKC0Vyu47PuIkfBWviAoACV6wk67ahzJDXPgxsTpJtyz5euQzqTVu_95QAnN9xLazCzMPsC9gBwFT3RifXYO

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template