git 本地与远程仓库出现代码冲突解决方法
提交过程中报错:
[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 本地与远程仓库出现代码冲突解决方法的更多相关文章
- Myeclipse如何使用自带git工具向远程仓库提交代码(转)
Myeclipse如何使用自带git工具向远程仓库提交代码 第一步:将改动的代码标记 项目右键:team->synchronize workspace 点击确定 项目右键>add to g ...
- Myeclipse如何使用自带git工具向远程仓库提交代码
先看一下Myeclipse自带的git工具 本人是在码云上面注册的账号,上面有项目的仓库,将仓库的项目克隆到本地之后,在myeclipse中导入该项目. 那么如何将修改后的代码再提交到码云上面? 第 ...
- git 本地给远程仓库创建分支 三步法
命令如下: 1:本地创建分支dev Peg@PEG-PC /D/home/myself/Symfony (master) $ git branch dev 2:下面是把本地分支提交到远程仓库 Peg@ ...
- 1. git 本地给远程仓库创建分支 三步法
命令如下: 1:本地创建分支dev 1 2 Peg@PEG-PC /D/home/myself/Symfony (master) $ git branch dev 2:下面是把本地分支提交到远程仓库 ...
- Git中清除远程仓库HTTPS认证信息的方法
Git远程仓库同步时用户认证有两种方式:HTTPS.SSH,对应的Git仓库上有两个不同的链接地址. https方式使用账号和密码授权,简单易用,便于进行权限细分管理,而且防火墙一般会打开 http ...
- SVN提交代码冲突解决方法总结
在近期svn提交代码时遇到多种情况的问题,现做一个解决办法的总结如下: 插播一条:idea下被svn版本控制各类文件的颜色区分,红棕色,未加入版本控制:绿色,已经加入控制暂未提交:蓝色,加入,已提交, ...
- asp.net mvc本地程序集和GAC的程序集冲突解决方法
一个从asp.net mvc 3升级到asp.net mvc 4的项目发生了如下错误: [A]System.Web.WebPages.Razor.Configuration.HostSection c ...
- sourceTree git 空目录从远程仓库克隆代码出现warning: templates not found
解决办法: 在安装git时没有默认安装到c盘,而是安装到了d盘.在使用SourceTree进行代码克隆时提示warning: templates not found in D:\software\de ...
- git本地仓库管理远程仓库
git remote add origin https://xxxxxgit push -u origin master
随机推荐
- CodeForces-245H:Queries for Number of Palindromes(3-14:区间DP||回文串)
Times:5000ms: Memory limit:262144 kB 给定字符串S(|S|<=5000),下标由1开始.然后Q个问题(Q<=1e6),对于每个问题,给定L,R,回答区间 ...
- Objective-C中的+initialize和+load
写在前面 近几天花了一些时间了解了一下Objective-C runtime相关的东西,其中涉及到了+load方法,譬如method swizzling通常在category的+load方法中完成.之 ...
- GCD的使用(1)使用GCD保护property
作为一个iOS开发者,必须要熟练使用GCD,本文是站在实际应用的角度总结GCD的用法之一: 使用barrier保护property.在多线程环境下,如果有多个线程要执行同一份代码,那么有时会出现问题, ...
- Ordered Fractions
链接 分析:遍历一下,求个gcd即可,最后按照ans排序并去重 /* PROB:frac1 ID:wanghan LANG:C++ */ #include "iostream" # ...
- VS2010中编写x64汇编的具体方法
编写涉及系统特性的一些底层程序,特别是ShellCode,不可避免地要采用直接编写汇编代码的方式. 在目标平台为x86模式时,可以直接使用内联汇编,这个很多人都比较熟悉了,也非常地方便. 但是当目标平 ...
- View Controller Programming Guide for iOS---(一)---About View Controllers
About View Controllers View controllers are a vital link between an app’s data and its visual appear ...
- JS中的回调函数实例浅析
本文实例讲述了JS中的回调函数.分享给大家供大家参考,具体如下: 在说回调函数之前,不妨先看一段代码,相信有点js基础的同学都能明白他的含义: ? 1 2 3 document.getElementB ...
- codforces 1C Ancient Berland Circus(几何)
题意 给出正多边形上三个点的坐标,求正多边形的最小面积 分析 先用三边长求出外接圆半径(海伦公式),再求出三边长对应的角度,再求出三个角度的gcd,最后答案即为\(S*2π/gcd\),S为gcd对应 ...
- lightoj1169【DP】
题意(来自大哥): 有两栋楼,左边一栋,右边一栋,层数从1-n,地面的标号为0,每一层有一个水果.有一只猴子在地面上,他现在要上到n层去,在第i层会吃掉水果花费一定时间. 猴子有两种方式从第i层到i+ ...
- springcloud(一) 服务拆分
一般我们的项目如果需要从单应用服务升级到微服务,必须要将原来的服务做拆分,我这边的拆分也是基于将之前spb-demo的springboot单应用做拆分,拆分出三个应用,spb-brian-query- ...