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
随机推荐
- [原]Windows下openssl的下载安装和使用
安装openssl有两种方式,第一种直接下载安装包,装上就可运行:第二种可以自己下载源码,自己编译.下面对两种方式均进行详细描述. 一.下载和安装openss 方法一:直接使用openssl安装包 W ...
- C++笔试题(三)
普天是南京一家通信公司,全称为:南京普天通信股份有限公司,公司网址为:http://www.postel.com.cn 网上流传一套普天C++笔试题,我将我做的答案公布与此,仅供参考. 1.实现双向链 ...
- SpringSercurity基础
创建 spring 配置文件 spring-security.xml intercept-url 表示拦截页面 /* 表示的是该目录下的资源,只包括本级目录不包括下级目录 /** 表示的是该目 ...
- 浅谈线段树 (例题:[USACO08FEB]酒店Hotel)By cellur925
今天我们说说线段树. 我个人还是非常欣赏这种数据结构的.(逃)因为它足够优美,有递归结构,有左子树和右子树,还有二分的思想. emm这个文章打算自用,就不写那些基本的操作了... 1° 简单的懒标记( ...
- mysql 用 group by 和 order by同时使用
首先,这是不可能实现的 mysql的查询的顺序 select -> from-> where->group by->having->order by. 但mysql的解析 ...
- hdu3926 Hand in Hand 同构图
#include<cstring> #include<cstdio> #include<algorithm> using namespace std; ]; str ...
- hdu1102 Constructing Roads 基础最小生成树
//克鲁斯卡尔(最小生成树) #include<cstdio> #include<iostream> #include<algorithm> using names ...
- BZOJ1833(数位dp)
这个数位dp倒是没什么限制条件,只是需要在过程中把每个数字出现次数记录一下即可.记忆化返回时数学算出.框架还是套板子. #include <cstdio> #include <cma ...
- Building Forest CodeForces - 195E
Building Forest CodeForces - 195E 这题意真是难懂啊...话说"An oriented weighted forest is an acyclic weigh ...
- matplotlib 绘图实例01:正弦余弦曲线
该讲的实例结果如下图所示: 第01步:导入模块,并设置显示中文和负号的属性: import matplotlib.pyplot as plt import numpy as np plt.rcPara ...