2015-12-28 72 views
2

我想壓縮6個提交到一個單一的提交使用我已經推到GitHub的分支。壁球提交在Git桌面

我試圖通過命令行來做到這一點,但我一直接受no-op而不是該分支的提交。

有沒有辦法通過GitHub桌面來做到這一點,可能會更有意義?

請儘可能一步步提供;

我對使用GitHub出於協作目的不熟悉,而且我的知識並沒有跨越git add,commit和push這麼遠。

回答

1

爲了做一個git壁球遵循這些步驟:

// X is the number of commits you wish to squash, in your case 6 
git rebase -i HEAD~X 

一旦壁球你的提交 - 選擇s爲壁球=將所有提交合併成一個單一的提交。

enter image description here


你也有--root標誌的情況下,你需要它

嘗試:git rebase -i --root

--root

Rebase all commits reachable from <branch>, instead of limiting them with 
an <upstream>. 

This allows you to rebase the root commit(s) on a branch. 
When used with --onto, it will skip changes already contained in `<newbase>` 
(instead of `<upstream>`) whereas without --onto it will operate on every 
change. When used together with both --onto and --preserve-merges, all root 
commits will be rewritten to have `<newbase>` as parent instead.` 
+1

也許這會聽起來很傻,但是當我嘗試在VIM屏幕上的命令行中輸入「S」,它只是將覆蓋「挑」的第一個「P」。我如何真正將它傳遞給命令?我也嘗試過:但它會產生消息「E33:沒有以前的替代正則表達式」 – Shwheelz

+0

您不能擠壓第一個,如果您想擠壓它將X設置爲7 – CodeWizard

+0

因此,如果我將「pick」更改爲「squash」對於第一個之後的5次提交,如何用vim「保存」? – Shwheelz