1

I merged my development branch called SGMII with the --squash option into the master branch as followed:

git checkout master
git pull origin master
git merge --squash SGMII
git commit -m "merge SGMII into master"
git push

However, when checked it on the gitlab website, it does not display the merge:

gitlab-graph

In addition, the SGMII branch is not marked as merged. Do you have any idea why they are not consistent?

Leonardo Alves Machado
  • 2,747
  • 10
  • 38
  • 53
Ernte1893
  • 183
  • 2
  • 11
  • That's how `git merge --squash` works. It creates a new non-merge commit in the target branch which introduces the changes from the other branch. If you want to see the merge commit in the graph, you need `git merge --no-ff`. – ElpieKay Sep 19 '18 at 09:07
  • Thanks for the reply. Good to know. However, also a compare on the gitlab page between `master` and `SGMII` did not show the required changes. There was nothing pushed into the master in the meanwhile. Therefore, the SGMII branch and the master should be equal (and in fact, they are). But the compare marks it differently. – Ernte1893 Sep 19 '18 at 09:24

1 Answers1

1

You can see a git merge --squash illustrated here: it does not produce a merge commit.

Produce the working tree and index state as if a real merge happened (except for the merge information), but:

  • do not actually make a commit,
  • do no move the HEAD, or
  • do not record $GIT_DIR/MERGE_HEAD (to cause the next git commit command to create a merge commit).

Therefore, the SGMII branch and the master should be equal (and in fact, they are). But the compare marks it differently.

If master is properly configured, the git push command should have pushed the local master to its remote GitLab repository origin/master upstream branch.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250