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
随机推荐
- POJ1113:Wall (凸包:求最小的多边形,到所有点的距离大于大于L)
Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the ...
- 【ZJOI 2008】树的统计
[题目链接] 点击打开链接 [算法] 树链剖分模板题 [代码] #include<bits/stdc++.h> using namespace std; #define MAXN 3000 ...
- 【Sdoi2008】沙拉公主的困惑
[题目链接] 点击打开链接 [算法] gcd(a,b)=gcd(a mod b, b),又m!|n! 则有ans=(n!/m!)·ϕ(m!) 由ϕ(n)=n(1-1 ...
- IOS:程序的退出、App间的跳转
今天在做一个音乐播放器的项目,发现这个点击退出程序的功能不能实现终于找到了一些有用的资料,就去网上看了半天资料,下面是退出程序的代码: 在动画里面可以自己添加一些,动画,达到相应的效果. AppDel ...
- 关于HTTP请求中更改body中传递的参数方法
更改body中传递的参数方法: String txId = UUID.randomUUID().toString().replaceAll("-", ""); ...
- sublime text 3中修改tab键为缩进4个空格
1. 菜单栏里点击 Preferences-> Setting-User, 如图 2. 在弹出来的文本里,添加如下两行: { // 注意只有一个大括号,如果之前有属性,如在之前的属性后确保有 , ...
- 任务24:WebHost的配置
24 任务24:WebHost的配置 创建HelloCore的项目 我们新建一个空的mvc项目 我们在这里调用COnfigureAppConfiguration方法更改默认的配置.为读取setting ...
- Untiy检测各类设备输入
轴需要单独设置 using UnityEngine; using System.Collections; using UnityEngine.UI; public class OutputKey : ...
- CentOS 7 设置系统语言为英文并解决 cannot change locale 问题
首次安装Cent OS 7.6时,将系统语言设置成了中文.后续学习和使用过程中却发现种种不便,甚至有翻译错误.为锻炼自己的英文能力,所以将系统语言设置问英文. 编辑 locale 配置文件,将 LAN ...
- 鸟哥私房菜基础篇:学习 Shell Scripts习题
猫宁!!! 参考链接:http://cn.linux.vbird.org/linux_basic/0340bashshell-scripts.php 鸟哥是为中国信息技术发展做出巨大贡献的人. 1-请 ...