- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
有没有一种方法可以在执行
时自动添加压缩的mybranch
提交中的所有提交注释
git merge --squash mybranch
以便单个提交包含来自 mybranch
最佳答案
我认为这就是“git merge --squash”自动执行的操作!只需使用“git commit --no-edit”进行提交,我想这就是你会得到的。在运行“git merge --squash”命令后,我立即在 .git/SQUASH_MSG 中看到了所有提交消息。你呢?
就我个人而言,我挤入 master,然后将结果强制推回我的主题分支。这样我的最终提交可以通过 pull 请求进行代码审查。
实例(尝试这些确切的命令,这使用我的演示服务器,并且确实有效):
git clone http://vm.bit-booster.com/bitbucket/scm/bb/rebase-example-2.git
cd rebase-example-2
git checkout branch
git reset --hard origin/master
git merge --squash origin/branch
git commit --no-edit
git show
commit 74656c51212526af49382c985419244737141217
Author: G. Sylvie Davies <sylvie@bit-booster.com>
Date: Mon Dec 26 22:07:50 2016 -0800
Squashed commit of the following:
commit 3120cbba4e94e0a81eed2f9ff42e7012cca996bf
Author: G. Sylvie Davies <sylvie@bit-booster.com>
Date: Thu Dec 15 18:24:02 2016 -0800
b2
commit ccb522334464879b8f39824031c997b57303475d
Merge: 6b85efb 026bf0c
Author: G. Sylvie Davies <sylvie@bit-booster.com>
Date: Thu Dec 15 18:13:35 2016 -0800
m
commit 6b85efbddbb74d49a096bfc54fd4df15e261b72f
Author: G. Sylvie Davies <sylvie@bit-booster.com>
Date: Thu Dec 15 18:12:51 2016 -0800
b1
在这一点上,我建议执行“git push --force-with-lease”,将这个压缩的提交提交到您的远程主题分支,为代码审查做好准备。
注意:我在示例中做了一件奇特的事情。我实际上挤进了 origin/master,而不是本地 master,我首先执行“git checkout branch”和“git reset --hard origin/master”。这使我的本地 master 不受此操作的干扰,因此无论我在那里可能正在做什么,都不会受到影响。
我正在使用 Git 2.7.4。也许较旧的 git 表现不同,我不知道。
如果你想在 Web UI 中完成这一切,并且你恰好使用 Atlassian Bitbucket Server(本地版本),你可以安装我的 Bit-Booster付费附加组件,然后点击它放在 pull 请求上的大“ Squash ”按钮。它做完全相同的事情,只是仅连接非 merge 提交消息。
关于git - Git merge --squash 可以保留提交注释吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41339160/
我从一个 Mercurial 存储库开始,它有多个我试图 merge 到其中的子存储库,就好像它们一直是主存储库的一部分一样。它们从一开始就不应该是子存储库。 我整理了一个将旧历史转换为单个存储库的过
假设我有一个主线分支和一个功能分支。我已经多次将主线分支 merge 到功能分支中,但只有少数非常小的 merge 冲突。我想清理历史,以便最后只有一个 merge 。执行此操作的最佳方法是什么? 最
首先我使用heapq.merge创建了a&b的两个结果,但是在mergea&b之后,我发现a的列表是空的。 >>> a=merge([1,2],[3,4]) >>> b=merge([4,5],[6,
我和我的团队正在使用远离主轨道 (origin/dev) 的远程分支 (origin/our_feature_branch) 开发一项功能。 Gerrit用于审查等。 使用 git merge ori
这个问题在这里已经有了答案: Is there a way to merge with Strategy "ours" without producing a new commit? (1 个回答)
GitLab 无法自动 merge 请求。所有 merge 请求都会收到消息“此 merge 请求包含必须解决的 merge 冲突。您可以在命令行上手动尝试” 消息似乎不正确,我通过使用“git br
git 有没有办法在不 merge 文件的情况下 merge 两个分支?换句话说就是绘制 merge 箭头。 假设我有分支 A 和 B。我需要将分支 B merge 到 A,但不需要 B 中的所有更改
我想使用提供 git 集成的流行的开源问题跟踪器 (Redmine)。不幸的是,跟踪器中的每个项目只能与一个 git repo 相关联。在跟踪器中创建多个项目不是我理想的设置。 考虑到这一点,我尝试使
在我们的存储库中,我们遵循基于 git-flow 的工作流程。我们有一个已完成的发布(安装在生产环境中),因此发布分支已 merge 到主分支中。 B---C---D---E [release
git merge 命令有一个执行快进 merge 的选项,但这不是我想要的,因为如果它不能执行快进 merge ,它会使用普通 merge . 是否有一个 git 命令仅执行快进 merge (从跟
尝试合并 TFS2008 时出现此错误。源分支或目标分支上都没有挂起的更改。 TF14083: The item {0} has a pending merge from the current me
为了更好地理解这些操作,我想知道 github 或 gitlab 到底是如何 merge 这些请求的。当压缩、 rebase 、 merge ......时详细执行哪些 git 命令? 最佳答案 PR
为了更好地理解这些操作,我想知道 github 或 gitlab 到底是如何 merge 这些请求的。当压缩、 rebase 、 merge ......时详细执行哪些 git 命令? 最佳答案 PR
我试图将提交的一部分从默认分支(不是所有文件和其他文件的部分) merge 到一个命名分支。我试过 graft ,但它只需要整个提交,而没有给我选择的机会。这将如何完成? 例子: A---B---C-
我正在进行 merge ,此时我已准备好提交,但我在 TortoiseHg 中的提交对话框显示许多文件已修改,但是当我与 parent 进行比较时,它说所有文件都是二进制相等的。 我没有也从未有过 e
我已经尝试了以下几种变体,但我仍然遇到错误。有什么办法可以解决这个问题。 DB2 10.1(DB2 for z/OS V10) 对于以下 MERGE INTO TRGT t USING SRC s O
我的数据库模型有用户和 MAC 地址。一个用户可以有多个MAC地址,但一个MAC只能属于一个用户。如果某个用户设置了他的 MAC,并且该 MAC 已经链接到另一个用户,则现有关系将被删除,并在新所有者
假设我有一个新功能,所以我创建了一个新分支。这个分支是一个会持续很长时间的副项目,所以我最终将 master merge 回它以使其保持最新状态。这已经发生了 50 次,因为我一直在更新它并消除该功能
过去几个小时我在 Mercurial 中进行了一次巨大的 merge 。 merge 131 个文件后,我的 merge 工具 meld 崩溃,显示 python 回溯。在尝试退出 meld 时,我无
我有一个关于 git merge 的问题。假设我的存储库中有两个分支(本地和远程):master 和 test。当我在测试分支上工作时,主分支被其他人更新了。在终端中,我写: git checkout
我是一名优秀的程序员,十分优秀!