删除一些git提交,以便它们不会出现在日志中

时间:2013-07-19 18:05:15

标签: git git-rebase

* 6a2da68        (styleChange) merge fix in setting
* dac420f        added libs
* 622021c        merging changes
| * 18847ab      (production/master, master) added couple of cdns
| * 8f02c19      minified css files
| * 276649a      (HEAD, testminify) added libs
| * f4b9533      fixed fb
|/  
* 2b4b490        prod ready
* 685a99c        removed dj static from settings file
* 1f012bc        added mailing support
* eb69d26        modified wsgi and static files
* bbd5c76        settings
* 39b229b        deleted some files
* 7e8ecaa        Initial Commit

正如你在上面看到的,我的头已经开启,276649a(添加了libs 提交) 截至目前我想摆脱提交前所有提交的头部,所以最后我的git图看起来如下 -

* 276649a        (HEAD, testminify) added libs
* f4b9533        fixed fb
* 2b4b490        prod ready
* 685a99c        removed dj static from settings file
* 1f012bc        added mailing support
* eb69d26        modified wsgi and static files
* bbd5c76        settings
* 39b229b        deleted some files
* 7e8ecaa        Initial Commit

有什么方法可以美化我的git branch树吗? 所以基本上我想摆脱冗余的未来分支和几个提交。

谢谢!

2 个答案:

答案 0 :(得分:0)

鉴于您不希望出现的提交位于不同的分支上,只要删除这些分支就足够了:

git branch -D styleChange
git branch -D master

答案 1 :(得分:0)

分离头然后将主人移到

git checkout 276649a
git branch -f master HEAD