合并冲突在压缩提交时破坏了我的提交信息 [英] Merge conflicts ruin my commit message while squashing commits

查看:18
本文介绍了合并冲突在压缩提交时破坏了我的提交信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常使用 git 的工作流程是创建一个新的功能分支,做一些频繁提交的工作,然后在功能工作和/或稳定时合并回开发分支.

My usual workflow with git is to create a new feature branch, do some work with frequent commits, and then merge back into the development branch when the feature is working and/or stable.

通常,当我执行 git merge --squash feature-branch 时,我会收到一个很好的以下内容的压缩提交"消息,该消息会自动填充来自功能分支的所有提交消息.

Usually, when I do git merge --squash feature-branch, I get a nice "squashed commit of the following" message that auto-populates with all of the commit messages from the feature branch.

然而,如果有任何合并冲突(假设我在处理这个特性时完成并合并了另一个特性),我似乎会丢失来自分支的所有提交消息.自动填充的提交消息会填充冲突,但不会填充提交消息.我的提交消息去了哪里?我可以拿回来吗?

However, if there are any merge conflicts (say I finished and merged another feature while working on this one), I seem to lose all of my commit messages from the branch. The auto-populated commit message fills in the conflicts, but not the commit messages. Where did my commit messages go? Can I get them back?

推荐答案

这并不能直接回答您的问题,但您首先应该能够避免冲突.

This doesn't answer your question directly, but you should be able to avoid the conflict in the first place.

考虑做一个

git rebase master topic

在执行合并之前.此页面的描述部分 http://git-scm.com/docs/git-rebase 应该会有所帮助.这也可能消除对壁球的需求,因为交互式变基将允许您挤压您选择的提交.

before performing the merge. The DESCTIPTION section of this page http://git-scm.com/docs/git-rebase should be helpful.This may also obviate the need for the squash as an interactive rebase would allow you to to squash commits of your choosing.

另见:在git中,有什么区别在合并 --squash 和 rebase 之间?

这篇关于合并冲突在压缩提交时破坏了我的提交信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆