0

What does

git merge origin origin/master

mean? It looks to me like were merging a remote repository with a branch on the remote repository. Here, origin is the remote repository and origin/master is the master branch on the remote repository. So what two branches are being merged? Thanks in advance!

1 Answer 1

0

All parameters to 'git merge' in this case are branches that you're merging from, i.e. source branches. You're always merging to the current branch.

Because origin is a remote name, git automatically expands it to that remote's default branch, so it's actually equivalent to origin/master – the command is being told to merge the same branch twice.

(It is possible to merge more than one branch, known as "octopus merge", but this is rarely done – and when it is done, the branches of course are different.)

As it is, the command doesn't make much sense. Maybe it should have been either git merge origin/master (without the duplication) or git pull origin master.

1
  • Thanks grawity! That makes sense, but you're right, doesn't make sense to mere two of the same branches together. For some context, here is where I saw the command (see the accepted answer): stackoverflow.com/a/45272685/11535048
    – eball
    Jul 25, 2019 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.