YoroDiallo YoroDiallo - 3 months ago 11
Git Question

what's better pull or merge to branches on github

I have some project on GitHub, there is few branches in there.


  • master

  • alpha

  • beta



for example. Now I create new branch
alpha-issue1
. On alpha branch was added some commits by my colleges and I want to copy this changes to my branch. First time I think
git merge alpha
would be good idea, but then I read about 'better way' -
git pull alpha test-issue1
(if I right). So I don't know what way to chose..

Answer

To answer your question directly: a git pull is (roughly) equivalent to git fetch ; git merge. If you want to, you can read up the exact behaviour in git help pull. So the difference between merge and pull is more about typing a few more or less commands, not about any functional difference.

Regarding the example commands you gave - no, they do not make sense.

git pull alpha test-issue1

Per your question, alpha is a branch, not a remote, so this is syntactically incorrect (the syntax is git pull <remote> ...). Also, you cannot give a "target" branch with git pull, all merges go into the currently checked-out branch.