git 使用总结
Posted ywendeng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git 使用总结相关的知识,希望对你有一定的参考价值。
1、使用git push origin -u master 将本地的仓库master分支和远程仓库master 分支关联
出现异常:
$ git push origin -u master
To git@github.com:JimGray11/Spark-study-java.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:JimGray11/Spark-study-java.git'
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.
异常的主要原因:
github中的README.md文件不在本地代码目录中
解决办法:
可以通过如下命令进行代码合并【注:pull=fetch+merge]
git pull –rebase origin master
以上是关于git 使用总结的主要内容,如果未能解决你的问题,请参考以下文章