Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need to git push first before git pull?

I have both local changes and remote changes.

Someone told me I must do push first, then pull. Any reason behind this?

like image 757
user496949 Avatar asked Sep 26 '13 15:09

user496949


1 Answers

That person is wrong: the right model is pull-before-you-push and not the reverse.

When you pull, git will fetch commits on origin and will try to fast-forward your local commits on top of them, doing the merge. After that you can push in this way you will not generate conflicts with other updates.

like image 111
Atropo Avatar answered Sep 28 '22 11:09

Atropo