
So the real answer would be: git checkout feature1 The GitFlow model asks you to merge the hotfix also to the development branch, which is "feature1" in your case.

You created a hotfix branch from master and merged it back. So what did you do right in your workflow? You have two branches to work with, your feature1 branch is basically the "develop" branch in the GitFlow model. It also is an extension to Git which adds some commands for the new workflow steps that do things automatically which you would otherwise need to do manually.

It is a branching model for git that can be followed, and you unconsciously already did. You committed both into the feature branch and the master branch. There is no point in forcing a fast forward merge here, as it cannot be done. How do we merge the master branch into the feature branch? Easy: git checkout feature1 I can not do a git merge master -ff-only: "fatal: Not possible to fast-forward, aborting.", but I am not sure if this helped me. This especially seems important for me if I use pull requests: All these commits will also be included in the pull request and have to be reviewed although this has already been done (as the hotfix is already in the master). I want to prevent to get two new commits on my feature branch which have no relation to the feature implementation. How can I achieve this without duplicating the commits into my feature branch? Say I need the hotfix in my feature branch, maybe because the bug also occurs there. The bug is fixed in the hotfix branch and merged back into the master (perhaps after a pull request/code review): echo "Bugfix" > bugfixFileĭevelopment on feature1 continues: git checkout feature1 Meanwhile, a bug is discovered in the master-code and a hotfix-branch is established: git checkout master Some modifications in the master take place and get committed: echo "On Master" > fileįeature1 branched off master and some work is done: git branch feature1

Let’s say we have the following situation in Git:
