error: failed to push some refs to
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
原因是commit之后,准备push时有人修改了代码
采用如下步骤
STEP 1: git stash
your local uncommitted changes on that branch.
STEP 2: git pull origin branch_name -v
to pull and merge
to locally committed changes on that branch (give this merge some message, and fix conflicts if any.)
STEP 3: git stash pop
the stash
ed changes (Then you can make commits on popped files if you want or push already committed changes (STEP4) first and make new commit to files later.)
STEP 4: git push origin branch_name -v
the merged changes.
将 "branch_name
" 替换成你的分支,如"master"