0%

github上版本和本地版本冲突的solution

情景:

1
2
3
4
5
6
7
8
$ git push -u origin master
To git@git.coding.net:xxxx.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@git.coding.net:xxxx.git'
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.

这时候加个-f (short for force) 强制push:

git push -u origin master -f

git 参考手册: http://git-scm.com/book/zh/v1