-1

I'm used to work with sourcetree and git-flow. Before closing a feature branch I usually merge develop into it.

To do so I right click the develop branch within my feature branch and choose 'merge develop into feature/...'. Afterwards I use the git-flow tool to finish the feature.

Now I wanted to do this with the terminal only (no sourcetree). Therefore, within the feature branch, I run 'git merge develop'. Afterwards I checkout develop and run 'git merge feature/...'

What I expected was a similar result as the sourcetree/git-flow way. But I ended up with a weird history! I've got now only the commit 'Merge branch develop in...' which is now part of the develop branch line. The 2nd commit (merge feature into develop) has disappeared although the file changes are still present.

Does anyone know what's going on here?

update

Steps to reproduce:

commit changes in feature branch
commit changes in develop branch
commit changes in feature branch
merge develop into feature branch (git merge)
merge feature into develop branch (git merge)

Afterwards the commit that merged feature into develop has disappeared (while the file changes are still present) and the history looks 'weird' meaning the feature branch commits become part of the develop branch history.

Kai
  • 51
  • 8
  • 1
    *But I ended up with a weird history* "weird history" isn't very helpful. Weird how? – Liam Aug 22 '18 at 08:09
  • run [`git log ....` and show us the results](https://stackoverflow.com/questions/1057564/pretty-git-branch-graphs) – Liam Aug 22 '18 at 08:11
  • here's the repo: https://github.com/SassNinja/git_merge_tests – Kai Aug 22 '18 at 08:15
  • could fast-forward be the problem? When I merge into my feature branch using --no-ff it seems better – Kai Aug 22 '18 at 08:37
  • That repo only has one branch, master. It's totally linear too. Without more information this question isn't answerable. – Liam Aug 22 '18 at 08:42
  • I did delete the feature branch in the course of the merge. Nevertheless I can still see the issue in my history. I've now done it again and pushed the branches develop & feature/example. When check it you'll see only the merge into feature is left (the merge into develop commit disappeared) – that's what I mean with weird – Kai Aug 22 '18 at 08:55

1 Answers1

0

I've found the solution myself. The problem was the default fast-forward fo git merge.

If I do git merge develop, checkout develop branch and do git merge feature with --no-ff everything is fine. Btw it's the same the git-flow tool does.

Kai
  • 51
  • 8