提交过程中报错:

[python@heaven-00 Selesystem]$ git push -u origin master
Username for 'https://github.com': sdfasname
Password for 'https://nighttidesy@github.com':
To https://github.com/nighttidesy/-Selesystem.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/nighttidesy/-Selesystem.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.

解决方法:

1.将远程仓库代码拉取到本地作为本地的一个新的分支 lingshi

[python@heaven- Selesystem]$ git fetch origin master:lingshi 

2.将这个lingshi的分支与我们的主分支对比查看有什么不同,有那些冲突

[python@heaven- Selesystem]$ git diff lingshi

3.将新的lingshi分支与本地主分支合并

[python@heaven- Selesystem]$ git merge lingshi

4.重新提交本地主分支到远程仓库

[python@heaven- Selesystem]$ git push -u origin master

[python@heaven-00 Selesystem]$ git push -u origin master
Username for 'https://github.com': sdfasname
Password for 'https://nighttidesy@github.com': 
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 25.50 KiB | 0 bytes/s, done.
Total 6 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 1 local object.
To https://github.com/nighttidesy/-Selesystem.git
5194ae2..939b6ee master -> master
Branch master set up to track remote branch master from origin.

成功

5.删除新的分支

[python@heaven- Selesystem]$ git branch -d lingshi

git 本地与远程仓库出现代码冲突解决方法的更多相关文章

  1. Myeclipse如何使用自带git工具向远程仓库提交代码(转)

    Myeclipse如何使用自带git工具向远程仓库提交代码 第一步:将改动的代码标记 项目右键:team->synchronize workspace 点击确定 项目右键>add to g ...

  2. Myeclipse如何使用自带git工具向远程仓库提交代码

    先看一下Myeclipse自带的git工具  本人是在码云上面注册的账号,上面有项目的仓库,将仓库的项目克隆到本地之后,在myeclipse中导入该项目. 那么如何将修改后的代码再提交到码云上面? 第 ...

  3. git 本地给远程仓库创建分支 三步法

    命令如下: 1:本地创建分支dev Peg@PEG-PC /D/home/myself/Symfony (master) $ git branch dev 2:下面是把本地分支提交到远程仓库 Peg@ ...

  4. 1. git 本地给远程仓库创建分支 三步法

    命令如下: 1:本地创建分支dev 1 2 Peg@PEG-PC /D/home/myself/Symfony (master) $ git branch dev 2:下面是把本地分支提交到远程仓库 ...

  5. Git中清除远程仓库HTTPS认证信息的方法

    Git远程仓库同步时用户认证有两种方式:HTTPS.SSH,对应的Git仓库上有两个不同的链接地址. https方式使用账号和密码授权,简单易用,便于进行权限细分管理,而且防火墙一般会打开 http ...

  6. SVN提交代码冲突解决方法总结

    在近期svn提交代码时遇到多种情况的问题,现做一个解决办法的总结如下: 插播一条:idea下被svn版本控制各类文件的颜色区分,红棕色,未加入版本控制:绿色,已经加入控制暂未提交:蓝色,加入,已提交, ...

  7. asp.net mvc本地程序集和GAC的程序集冲突解决方法

    一个从asp.net mvc 3升级到asp.net mvc 4的项目发生了如下错误: [A]System.Web.WebPages.Razor.Configuration.HostSection c ...

  8. sourceTree git 空目录从远程仓库克隆代码出现warning: templates not found

    解决办法: 在安装git时没有默认安装到c盘,而是安装到了d盘.在使用SourceTree进行代码克隆时提示warning: templates not found in D:\software\de ...

  9. git本地仓库管理远程仓库

    git remote add origin https://xxxxxgit push -u origin master

随机推荐

  1. [shell test] multiple conditions

      Classic technique (escape metacharacters): if[ \( $g -eq 1-a "$c"="123" \) -o ...

  2. C#中的Webservice实例代码(vs2013)

    2.1首先创建一个最基本的web service服务端,顾名思义就是提供服务,这儿实现一个简单的加法计算. 首先,vs2013--文件---新建项目---Asp.net 空Web 应用程序    (V ...

  3. (链接)Tomcat设置Session的失效方式

    tomcat 设置session过期时间(四种方式):https://blog.csdn.net/liuxiao723846/article/details/50055075 tomcat里设置ses ...

  4. J20170426-hm

    ジェネリクス Generics 泛型 バルーン balloon 气球 アングルブラケット Angle bracket 尖括号 プレースホルダ Placeholder 占位符

  5. POJ1050【DP】

    题意: 求一个最大子矩阵和. 思路: 枚举行区间,然后求一个最大子序列和. 贴一发挫code- #include <iostream> #include <cstdio> #i ...

  6. IDEA打开父类的接口方法快捷键

    有两个类,分别为A类是接口.B类为A的实现类. 如果想在B类里的某个方法,打开A类 可以鼠标右键点击这个方法名,按下键盘:Ctrl+U,就可以跳转到A类接口的该方法上面.

  7. PJzhang:微信公众号短连接与微信好友验证

    猫宁!!! 参考链接:https://mp.weixin.qq.com/s/LPuYrDEyEXHyhcK3_HokSg 之前看到他们有人把微信公众号文章的长链接转为短链接,很受用,百度搜索一下方法, ...

  8. tyvj 1391 走廊泼水节【最小生成树】By cellur925

    题目传送门 题意简化:给你一棵树,要求你加边使它成为完全图(任意两点间均有一边相连) ,满足原来的树是这个图的最小生成树.求加边的价值最小是多少. 考虑Kruskal的过程,我们每次找一条最短的,两边 ...

  9. iOS 获取当前响应链的First Responder (Swift)

    import UIKit private weak var currentFirstResponder: AnyObject? extension UIResponder { static func ...

  10. only-child选择器

    :only-child选择器用于匹配属于某一个父元素的唯一子元素的元素,也就是说,如果某个父元素仅有一个子元素,则使用  :only-chlid选择器  ,可以选择这个子元素