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?
- git - changing versions of code?
- Git “force push” from new local repo to remote, but keeping remote commit history
- On git push I got error: error: invalid protocol: wanted 'old new ref'
- Git is pushing to wrong remote branch
- Git without complete local copy
- Why does “git push” work after doing “git push origin --delete BRANCHNAME”?
One Solution collect form web for “Why do we need to git push first before git pull?”
That person is wrong: the right model is
pull-before-you-push and not the reverse.
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.