0

I have a branch (mainbranch) which is recently derived from the master.

If a do a git pull origin otherbranch will that merge the branch otherbranch to the mainbranch derived from master?

Git merge can be used but curious to know what will the above statement do.

What i need is to merge otherbranch with main branch and megre is giving error

fatal: 'otherbranch' does not point to a commit 

1 Answer 1

1

This command is equivalent to

git fetch origin otherbranch git merge FETCH_HEAD 

And will therefore:

  1. Fetch the history of the remote branch otherbranch from remote origin (its head commit is temporarily saved in FETCH_HEAD).
  2. Merge the history of origin/otherbranch (which is now in FETCH_HEAD) into the currently checked out branch.
Sign up to request clarification or add additional context in comments.

4 Comments

so it means in my example, the otherbranch is merged to mainbranch ?
If mainbranch is checked out, yes.
the branch was not a local, it was branch at github, still ?
Git is always local, fetch/merge (or pull) fetch the history from the remote and do the merge locally. But yes, it was the branch from GitHub (or whatever origin points to).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.