一、”![rejected] master -> master (fetch first)”
执行命令 git fetch 拉取服务器上仓库
Someone else (or you on some other machine) has pushed a changeset to the remote repository. You, on your local machine dont have those changes yet.
二、![rejected] master -> master (non-fast-forward)
执行命令”git pull origin master”
I’ll provide an example and a picture to explain. Let’s assume your last pull from origin/branch was at Commit B. You have completed and committed some work (Commit C). At the same time, someone else has completed their work and pushed it to origin/branch (Commit D). There will need to be a merge between these two branches.
local branch: --- Commit C / / / origin/branch: Commit A ------ Commit B ---- Commit D
Because you are the one that wants to push, Git forces you to perform the merge. To do so, you must first pull the changes from origin/branch.
local branch: --- Commit C -- Commit E / / / / / / origin/branch: Commit A ---- Commit B ---- Commit D
After completing the merge, you will now be allowed to fast-forward origin/branch to Commit E by pushing your changes.