Git:如何将分支功能重新建立到分支开发基础上减去分支MyLocalChanges [英] Git: How do I rebase Branch Feature back onto Branch Develop minus Branch MyLocalChanges
问题描述
我们有一个 develop 分支,并根据需要从 develop 创建了许多 feature 分支,最终将这些分支合并回开发.
工作时,我要进行一组本地更改,这些更改包括设置更改,脚本更改,模块更改等,这些更改会更改各种标志或日志消息,或者执行此操作或执行该操作.与团队的工作量不同.
我想将这些更改保留在一个基于 develop 的分支中,该分支称为 MyLocalChanges ,该分支将被开发并合并(?)成为什么功能我正在使用的em>分支,但永远不会合并回 develop
然后最后,当所有内容都经过测试后,我想创建一个拉取请求或将( Feature - MyLocalChanges )改成基准 Develop ,我想从命令行执行此操作,而无需使用rebase -i
也许它可以这样表达:
git merge (feature - (diff mylocalchanges develop)) develop
如何在git中执行此操作?这种减法合并或变基称为什么?
由于合并提交减去一些更改"并非易事,因此最好:
- 仅版本 template 文件,其中填充了对团队有效的默认值
- 拥有具有自己价值的私人文件
- 使用能够生成具有正确值的实际配置文件的脚本版本:这些生成的文件也将是私有的(这样,合并时不会出现问题)
在此处查看此类内容过滤器驱动程序的示例.
We have a develop branch and many feature branches that are created from develop as needed and will eventually be merged back into develop.
When I work, I have a set of local changes I like to make, these are changes to settings, changes to scripts, changes to modules, etc. that change various flags, or change log messages, or do this or that differently from how much of the team works.
I'd like to keep those changes in a branch based on develop called MyLocalChanges which would be developed and merged (?) into what feature branch I am working on, but which never be merged back into develop
And then in the end, when everything has been tested, I'd like to either create a pull request or do a rebase of (Feature - MyLocalChanges) onto Develop and I'd like to do that from the command line, without using rebase -i
Perhaps it might be expressed like this:
git merge (feature - (diff mylocalchanges develop)) develop
How do I do this in git? What is this sort of subtractive merge or rebase called?
Since it is not trivial to merge a commit "minus some changes", it is best to:
- only version template files, filled with default values valid the team
- have private files with your own value
- version a script able to generate the actual config files, with the right values: those generated files would also be private (that way, no issue when merging)
See an example of such a content filter driver here.
这篇关于Git:如何将分支功能重新建立到分支开发基础上减去分支MyLocalChanges的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!