标签:一个 local status test failed 修改 include 固定 his
这个不用说了,在github或者本地的gitlab上创建,拿到ssh或者Https地址
1.新建文件夹,在文件夹内打开终端
2.初始化本地的文件夹为一个git可以管理的仓库
git init Initialized empty Git repository in X:/javaCode/workspace_MyBatis/.git/
$ git remote add origin https://git.oschina.net/wang522shuo/mybatistest.git
$ git status On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) ws.mybatis/ nothing added to commit but untracked files present (use "git add" to track)
$ git add .
$ git commit -m"提交" [master (root-commit) dd7804b] 提交 9 files changed, 369 insertions(+)
$ git push -u origin master To https://git.oschina.net/wang522shuo/mybatistest.git ! [rejected] master -> master (fetch first) error: failed to push some refs to ‘https://git.oschina.net/wang522shuo/mybatistest.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.
这个时候会报错
这里出错的原因是由于我在Coding创建项目的时候,勾选了启用Readme文件初始化项目,导致远程库有一个Readme文件即非空的仓库,本地必须先把远程的文件pull下来(git pull origin master)然后才能push (git push origin master).
终端输入 git pull origin master 之后,会进入vim的编辑状态
这个界面是在pull服务器代码和你本地代码做合并的时候,让你填写合并信息的。你可以不用管。如果公司有固定的提交格式的时候你就需要: 按键盘上字母i,进入insert模式去修改最上边一行合并信息。然后在输入 :wq 保存退出即可。
如果合并信息没有强制要求格式,有以下几种办法:
1.输入:wq 直接保存退出 (一般这个)
2.输入 :q 就是直接退出
3.在键盘上按control + z (强制退出)
再次输入git push origin master (git pull --rebase origin master) 就可以了 ,然后就可以在coding上看到同步了
标签:一个 local status test failed 修改 include 固定 his
原文地址:http://www.cnblogs.com/langtutengyixiao/p/7087356.html