Squash 在 Git 桌面中提交
Squash Commits in Git Desktop
我正在尝试使用我已经推送到 GitHub 的分支将 6 次提交压缩为一次提交。
我尝试通过命令行执行此操作,但我一直收到空操作而不是该分支的提交。
有没有可能更有意义的通过 GitHub 桌面执行此操作的方法?
如果可能,请提供步骤;
我刚开始使用 GitHub 进行协作,我的知识范围不超过 git 添加、提交和推送。
要进行 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.`
来自 Thoughtbot 的 post 可能会帮助您通过命令行完成它。确切地知道您在做什么可能比依赖 GUI 工具 Git 更好。它将使您受益匪浅 运行.
https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history
Is there a way to do this via GitHub desktop that might make more sense?
从 2.9 版开始,现在可以在 GitHub 桌面版中压缩提交。
这里有两种方便的方法。
- Select “历史”选项卡中的多个提交(使用 Ctrl 或 Shift 键),右键单击其中一个selected 提交和 select“Squash 2 提交...”。
- 将一个分支合并到另一个分支时,单击右侧的箭头提交按钮和select“压缩并合并”。
我正在尝试使用我已经推送到 GitHub 的分支将 6 次提交压缩为一次提交。
我尝试通过命令行执行此操作,但我一直收到空操作而不是该分支的提交。
有没有可能更有意义的通过 GitHub 桌面执行此操作的方法?
如果可能,请提供步骤;
我刚开始使用 GitHub 进行协作,我的知识范围不超过 git 添加、提交和推送。
要进行 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.`
来自 Thoughtbot 的 post 可能会帮助您通过命令行完成它。确切地知道您在做什么可能比依赖 GUI 工具 Git 更好。它将使您受益匪浅 运行.
https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history
Is there a way to do this via GitHub desktop that might make more sense?
从 2.9 版开始,现在可以在 GitHub 桌面版中压缩提交。
这里有两种方便的方法。
- Select “历史”选项卡中的多个提交(使用 Ctrl 或 Shift 键),右键单击其中一个selected 提交和 select“Squash 2 提交...”。
- 将一个分支合并到另一个分支时,单击右侧的箭头提交按钮和select“压缩并合并”。