执行git合并时可以排除特定的提交吗? [英] Is it possible to exclude specific commits when doing a git merge?
问题描述
到目前为止,我的策略是执行以下操作(在master中):
git merge --no-commit release-branch
#解决冲突并应用提交的反向修补程序不希望包含
git commit#编辑提交消息,以便它列出已反向修补的提交
有没有更好的方法来做到这一点?
创建一个新分支, drop提交你不想要的,然后合并。
你不能在没有重新哈希的情况下从分支中间取出更改,但会发生正确的事情当它在后面的合并中看到相同的变化时(例如,从樱桃采摘和不采用什么)。
Let's say that I want to merge from a release branch to the master branch and there are some commits in the release branch that I don't want to include in the master branch. Is there a way to do the merge so that one or more of those commits will not be merged?
My strategy so far is to do the following (in master):
git merge --no-commit release-branch
# Resolve conflicts and apply reverse patch of the commits that I don't want included
git commit # Edit commit message so that it lists the commits that have been reverse-patched
Is there a better way to do this?
Create a new branch, rebase the branch interactively and drop commits you don't want, and then merge that.
You can't take changes out of the middle of a branch without rehashing, but the right thing will happen when it sees the same changes in a later merge (e.g. from cherry-picking and what-not).
这篇关于执行git合并时可以排除特定的提交吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!