git提交代码到github冲突解决
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决方法
解决方案一.正常解决推荐
git fetch origin //更新远程仓库文件
git diff master origin/master //本地文件和远程仓库文件进行对比
git merge origin/master //自动合并
解决方案二:强制推送( **会覆盖冲突以这次为准,不建议 ** )
$ git push -f
解决方案三:(强制覆盖本地代码,你自己修改的代码即将被远程库的代码所覆盖)
把你修改的代码进行备份,然后执行命令:
git reset --hard origin/master
git pull
tip:除了git log之外还有一个很好用“gitk”界面化展示提交log记录