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 FULL push , no refs?
  • fatal: unable to create 'refs/heads/master.lock': File exists fatal: - Getting this error while pushing the commits
  • How do I push files specified in .gitignore?
  • How to update the repository with unaccepted pull requests?
  • why i cannot push mirror to github?
  • Force “git push” to overwrite remote files
  • Is a git commit required if I rollback using 1) git hard reset or 2) git revert?
  • Images corrupt after git push
  • 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.

    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.

    Git Baby is a git and github fan, let's start git clone.