-2

I have two branches (picture 1):

A -------------   <-- master(no commits in master)
 \
  B - C - D - E   <-- develop

I want to merge develop into master and i want to see no B,C,D commits in master (picture 2):

A ------------- E   <-- master
 \            /
  B - C - D - E     <-- develop

I use command:

git merge --no-ff develop

But i get message:

already-up-to-date

What should i do to see picture 2?

  • 2
    That message indicates you are not actually at the state in picture 1. (Assuming you checked out `master` that is) – M.M Jul 26 '18 at 05:09
  • 1
    Possible duplicate of [Git merge without including commits from one branch to another](https://stackoverflow.com/questions/14824431/git-merge-without-including-commits-from-one-branch-to-another) – CodeCaster Jul 26 '18 at 07:35
  • So you want only the changes from commit E, or do you want commits B-E to be represented in one new merge commit? If the former, your want a cherrypick, see [How to merge a specific commit in Git](https://stackoverflow.com/questions/881092/). But you don't want to, read the warnings in those answers, and see also: [Stop cherry-picking, start merging](https://blogs.msdn.microsoft.com/oldnewthing/20180323-01/?p=98325) by Raymond Chen. If the latter, see [Git merge without including commits from one branch to another](https://stackoverflow.com/questions/14824431/). – CodeCaster Jul 26 '18 at 07:36
  • I want all commit bcde from develop became single commit e on master. – S. Apanasyonok Jul 26 '18 at 07:55
  • Have you switched to master before merging? – sergej Jul 26 '18 at 08:11
  • If a branch name exists, there are commits on that branch. So there *are* commits in `master`. In your drawing there is one commit in master, namely `A`; commit `A` is *also* in branch `develop`. If you wish to copy the *effects* of commits `B` through `E` to a new commit `F` that is only in `master`, you can use `git checkout master; git merge --squash develop`. Note that commit `A` will remain contained in both branches and commits `B` through `E` will remain in `develop`. – torek Jul 26 '18 at 14:41

1 Answers1

0

Thanks for all comments. I was not at master branch when try to make merge (i was at branch which match develop fully). Right answer:

git merge --no-ff develop