-->

壁球都是我提交到一个GitHub的拉动请求[复制](Squash all my commits in

2019-07-18 17:49发布

这个问题已经在这里有一个答案:

  • 壁球我最后的X犯下一起使用Git 29个回答

我做了GitHub上拉请求。 现在仓库的主人是说给所有提交挤进了一个。

当我键入git rebase -i记事本中打开,其内容如下:

noop

# Rebase 0b13622..0b13622 onto 0b13622
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

我搜索在谷歌,但我不知道如何做到这一点。

Answer 1:

只是一个简单的除了帮助别人寻找这种解决方案。 你可以在你想壁球以前提交数通过。 例如,

git rebase -i HEAD~3 

这将带来近3个提交在编辑器中。



Answer 2:

好,我想通了......首先,我不得不写git rebase -i xxxxxxxxxxxxxxxx其中XXXXXXXXXX是的提交SHA高达我已经到壁球。 然后在记事本中我编辑了第一所有壁球的挑选和休息。 然后,一个新的记事本窗口会来,有在第一线我输入我的新的承诺的名称。 然后,我不得不做力推:

git push --force origin master


Answer 3:

随着2016年4月1 ,仓库的管理者可以南瓜拉要求所有提交到一个单一的选择上拉请求“壁球和合并”承诺。

如果你想在拉入请求手动壁球提交,请参阅的fontno答案 。



Answer 4:

尝试git rebase -i ,并用“南瓜”对所有要壁球提交。

编辑:

git rebase -i会告诉你你需要衍合的提交名单的交互式编辑器。 每个前默认命令提交被“挑”,所以你只需要发/接/壁球/所有你想壁球提交,然后所有的人都将挤进他们的最后一次提交。

请确保您在正确的分支基础重建。



文章来源: Squash all my commits into one for GitHub pull request [duplicate]