Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use 'pull' or 'merge' to merge local branches?

I have seen two different ways of merging local branches.

git checkout master
git merge new_feature


git checkout master
git pull . new_feature

What is the difference, pros/cons?

like image 223
Kris Avatar asked Jun 02 '09 13:06

Kris


1 Answers

Locally speaking, there is no difference between merge and pull. When dealing with remotes, "pull" fetches the remote's objects first, then merges with the local branch. But when dealing with local branches, there is nothing to fetch (all objects are already in the local repository) so the "fetch" part of pulling is effectively a no-op. In the local case, then, "pull" is basically the same as just "merge".

like image 128
Dan Moulding Avatar answered Sep 19 '22 13:09

Dan Moulding