2013-10-17 128 views
0

我被要求在github上压缩提交请求上的提交。当我运行壁球提交拉请求

git rebase -i HEAD~5 

它看起来像这样

pick bcbb30d My commit comment 
pick 8564706 Other persons commit comment 
pick c99bdd2 Other persons commit comment 
pick 07bb5b9 Other persons commit comment 
pick 2bcff6f Other persons commit comment 
pick 77a5076 My commit comment 

正如我只想壁球MY提交,是否确定把“南瓜”对所有我的,但一个(把它当作“挑'),并让其他人的提交也作为“选择”了?这只会压缩我的承诺吗?

+0

请注意,当您压缩提交时,您正在重写回购历史记录。如果你处理已经在遥控器上的修改(可能是你的情况,因为你正在拉动遥控器),如果你强制使用它('-f'),遥控器将只接受你的推送。如果你不是一个人工作的话(和其他人已经有你改变的历史),这是特别有问题的。 – talles

回答

3

尝试是这样的

pick 8564706 Other persons commit comment 
pick c99bdd2 Other persons commit comment 
pick 07bb5b9 Other persons commit comment 
pick 2bcff6f Other persons commit comment 
pick bcbb30d My commit comment 
squash 77a5076 My commit comment 

你可以自由地重新排序承诺以及壁球他们。因此,假设没有内部提交依赖关系,您应该将提交放在其他提交之上。

+0

是否必须将我最近的提交作为“壁球”提交? – catrapture

+2

不,但它并不重要,因为您将两个提交合并为一个提交。如果您更改订单,它仍然会以同样的方式结束。 – Ben

2

假设补丁将干净的应用,你可以在你的git rebase -i命令获得,然后编辑器重新排列壁球只是你:

pick 8564706 Other persons commit comment 
pick c99bdd2 Other persons commit comment 
pick 07bb5b9 Other persons commit comment 
pick 2bcff6f Other persons commit comment 
pick bcbb30d My commit comment 
squash 77a5076 My commit comment 

现在,您将得到一个编辑器修复你(合)提交消息。