سؤال

Let's assume you are merging one branch in Git to another one(no fast forward of course). And you don't have conflicts, so the merge should be successful, without interruptions. But by some reasons you want to make some manual changes directly to this merged file tree to be a part of this merging commit. How to do that?

Why do I need such strange thing? It is due to my workflow process(which is in fact maybe a subject to be improved too - so advices here are very welcome): I have one "master" branch, and when I want to implement a new feature I deriving a new branch from master and using it until the feature is done. Then I'm merging this branch to the master back(using no-ff mode). But the issue here is that my version policy(Semantic versions to be specific) requires to increase version number alongside the new feature is done. So at this moment I have to do another one commit directly to the master with non code changes to the config files indicating that here is a new version. As a result I have to commit two commits in master refers to a new version: merge commit without indications in configs of the new version, and the followed by commit with such indications but without any essential changes in the code base. So for a first glance it would be nice to combine such commits. But I don't know how.

هل كانت مفيدة؟

المحلول

You can merge it with param --no-commit

git merge --no-ff --no-commit mybranch

So after that your changes from branch "mybranch" will be transfered to your master, but without commit. So you can add changes to version policy and only then do one commit

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top