M HYPE SPLASH
// news

git merge origin origin/master - Interpretation

By Andrew Adams

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

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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