0

如何合并我的 git 项目的历史记录,以便所有提交历史记录都被视为一个分支的一部分?

目前我有这个:

* 465a83a Highlight search
* 37a367d Tab=3; AutosaveSession (Not using yet)
*   9f2559c Merge branch 'master' of github.com:shahverdy/.vim
|\  
| * 6bf7783 SaveSession was added.
| |\  
| | * 6cdd383 Some changes with path allocation
| | |\  
| | | * de535b2 Update README.md
| | | * cb78dae Update README.md
| | | * 6664428 Update README.md
| | | * b6f3869 Some extra modifications + README.ms
| | | * 0924e77 Oops! vimrc was not included in the last commit
| | | * c030172 sweeping away ...
| | | * d67280e bundle installer was added, some extaras was sweeped away
| | | * 10a669c Cursors fixed...
| | | * 9dfd01f Cursors was edited ...
| | | * 0b5d8aa Syntax for PHP and Javascript was added
| | | * dd5a21d A bug fixed
| | | * ad5b9f2 Syntax for PHP and Javascript was added
| | | * 99e5595 Fixed code folding+ search highlighting
| | | * 69c7f77 File Explorer fixed
| | | * ba5fbf7 .vimrc was added
| | * f875ee1 A totel reset
| * 9edf692 Update
* 9c71074 new plugins

我想要这个:

* 465a83a Highlight search
* 37a367d Tab=3; AutosaveSession (Not using yet)
* 9f2559c Merge branch 'master' of github.com:shahverdy/.vim
* 6bf7783 SaveSession was added.
* 6cdd383 Some changes with path allocation
* de535b2 Update README.md
* cb78dae Update README.md
* 6664428 Update README.md
* b6f3869 Some extra modifications + README.ms
* 0924e77 Oops! vimrc was not included in the last commit
* c030172 sweeping away ...
* d67280e bundle installer was added, some extaras was sweeped away
* 10a669c Cursors fixed...
* 9dfd01f Cursors was edited ...
* 0b5d8aa Syntax for PHP and Javascript was added
* dd5a21d A bug fixed
* ad5b9f2 Syntax for PHP and Javascript was added
* 99e5595 Fixed code folding+ search highlighting
* 69c7f77 File Explorer fixed
* ba5fbf7 .vimrc was added
* f875ee1 A totel reset
* 9edf692 Update
* 9c71074 new plugins

编辑

我试过git rebase了,输出是Current branch master is up to date.,并且仍然像以前一样显示历史。

谢谢

4

1 回答 1

1

使用git rebase --interactive 9c71074- 默认情况下合并提交是squashed. 这是一个例子。

ebg@ebg(390)$ git log --graph --oneline --all
*   67fc064 Merge branch 'br-b'
|\  
| *   ae81ba0 Merge branch 'br-c' into br-b
| |\  
| | * 7fc3f2c c2
| | * ee878fc c1
| | * 08bbe31 c
| * | 7112b66 b2
| |/  
| * fb2bb16 b
* | a4c6fb7 a2
|/  
* e2f832e a
ebg@ebg(391)$ git rebase --interactive e2f832e
Successfully rebased and updated refs/heads/master.
ebg@ebg(392)$ git log --graph --oneline --all
* 1123db2 c2
* 47b327e c1
* 8136393 c
* 4276b1f b2
* 1020ffa b
* a4c6fb7 a2
| *   ae81ba0 Merge branch 'br-c' into br-b   # NOT ON MASTER
| |\  
| | * 7fc3f2c c2
| | * ee878fc c1
| | * 08bbe31 c
| * | 7112b66 b2
| |/  
| * fb2bb16 b
|/  
* e2f832e a
ebg@ebg(393)$ git log --graph --oneline       # ONLY MASTER
* 1123db2 c2
* 47b327e c1
* 8136393 c
* 4276b1f b2
* 1020ffa b
* a4c6fb7 a2
* e2f832e a
于 2013-04-05T15:34:51.097 回答