我想压缩6个提交到一个单一的提交使用我已经推到GitHub的分支。壁球提交在Git桌面
我试图通过命令行来做到这一点,但我一直接受no-op而不是该分支的提交。
有没有办法通过GitHub桌面来做到这一点,可能会更有意义?
请尽可能一步步提供;
我对使用GitHub出于协作目的不熟悉,而且我的知识并没有跨越git add,commit和push这么远。
我想压缩6个提交到一个单一的提交使用我已经推到GitHub的分支。壁球提交在Git桌面
我试图通过命令行来做到这一点,但我一直接受no-op而不是该分支的提交。
有没有办法通过GitHub桌面来做到这一点,可能会更有意义?
请尽可能一步步提供;
我对使用GitHub出于协作目的不熟悉,而且我的知识并没有跨越git add,commit和push这么远。
为了做一个git壁球遵循这些步骤:
// X is the number of commits you wish to squash, in your case 6
git rebase -i HEAD~X
一旦壁球你的提交 - 选择s
为壁球=将所有提交合并成一个单一的提交。
你也有--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.`
这个职位来自Thoughtb或许可以通过命令行帮助你解决问题。最好确切地知道你在做什么,而不是依靠Git的GUI工具。从长远来看,这会对你有利。
https://robots.thoughtbot.com/git-interactive-rebase-squash-amend-rewriting-history
也许这会听起来很傻,但是当我尝试在VIM屏幕上的命令行中输入“S”,它只是将覆盖“挑”的第一个“P”。我如何真正将它传递给命令?我也尝试过:但它会产生消息“E33:没有以前的替代正则表达式” – Shwheelz
您不能挤压第一个,如果您想挤压它将X设置为7 – CodeWizard
因此,如果我将“pick”更改为“squash”对于第一个之后的5次提交,如何用vim“保存”? – Shwheelz