1

I am tying to do something that I have done many times before but for some or other reason it is not working as expected.

I want to merge changes from a develop branch into a master branch.

First I create a branch of master.

git checkout -b merge-develop-master
Switched to a new branch 'merge-develop-master'

then

git merge develop

This results in a whole list of changes that gets merged

when I now type git status it tells me

On branch merge-develop-master
nothing to commit, working tree clean

Now when I type git push --set-upstream origin merge-develop-master no changes gets pushed,

Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To https://xxx-xxx-xxx
 * [new branch]        merge-develop-master -> merge-develop-master
 Branch 'merge-develop-master' set up to track remote branch 'merge-develop-master' from 
 'origin'.

How can I push these changes, what am I doing wrong?

Thanks

Arianule
  • 8,811
  • 45
  • 116
  • 174
  • You already pushed those changes, that's what that last output showed. You pushed them to a new branch on the remote named `merge-develop-master`. Since you feel like you're doing something wrong, can you perhaps explain **why** you feel like this? Did you expect some specific result that you didn't get? – Lasse V. Karlsen Feb 16 '22 at 07:38
  • The fact that 0 was pushed probably mean that you only pushed a new branch, but the commits were already present. It's not possible for us to understand why without more of the output from previous commands. – Lasse V. Karlsen Feb 16 '22 at 07:39
  • 1
    Could it be that you did a fast-forward merge? In essence just move the branch pointer to another existing commit? – Lasse V. Karlsen Feb 16 '22 at 07:40
  • Thanks. Not sure. in the step `git merge-develop` it does give me the message fast-forward and the the list of updates that are merged. Issue is that upon gits status I am not seeing anything. `nothing to commit, working tree clean` – Arianule Feb 16 '22 at 07:42
  • Why is that an issue? That just means every file on disk in the working folder is part of the snapshot you're currently at in the git repository history. Did you expect some files needing to be committed? – Lasse V. Karlsen Feb 16 '22 at 07:55
  • If it said `fast-forward`, that was a fast-forward (i.e., not really a merge at all) "merge". That means there are no new commits to send, in order to create the branch name, which explains all the output. – torek Feb 16 '22 at 08:06
  • I started from the branch master. I created a new branch from master (merge-develop-master), i merged changes from develop into this new branch. It tells me there is nothing to commit. I would expect to see these changes and to be able to commit these changes. This is the issue – Arianule Feb 16 '22 at 08:13

1 Answers1

1

This is likely because your develop and merge-develop-master are identical

If you run git log you should see the latest commit points to both branches.

This means when you push upstream, there aren’t any changes that need to be sent. Your upstream just creates a new branch pointing to a commit it already knows about.

deric4
  • 1,095
  • 7
  • 11