git - 将我所有的提交压缩为 GitHub pull 请求

标签 git github pull-request squash

<分区>

我在 GitHub 上提出了 pull 请求。现在存储库的所有者说要将所有提交压缩为一个。

当我输入 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

我在 Google 上搜索过,但我不知道该怎么做。

最佳答案

只是一个简单的补充来帮助其他人寻找这个解决方案。您可以传入要压缩的先前提交的数量。例如,

git rebase -i HEAD~3 

这将在编辑器中显示最后 3 次提交。

关于git - 将我所有的提交压缩为 GitHub pull 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14534397/

相关文章:

c++ - 使用虚幻引擎 4 和 Visual Studio 团队服务

ubuntu - 没有到主机的路由。 ubuntu 上的 Github( Composer )

Github 页面 : How to extend base layout?

git - Fork github 存储库及其 pull 请求

git - 你如何在 magit 中列出跟踪文件(git ls-files)?

linux - 我们可以使用 quilt 推送/添加到本地 git 存储库吗?

git - 如果您强制推送到具有现有 pull 请求的分支,会发生什么情况?

github - 如何更改拉取请求的基本分支?

由于冲突,Git merge 失败

git - 我如何处理 Git 存储库中的图像?