提交过程中报错:

[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. NOIP2004题解

    传送门 考查题型 dp 搜索 模拟 数据结构堆 贪心 T1   津津的储蓄计划 题目描述 津津的零花钱一直都是自己管理.每个月的月初妈妈给津津300元钱,津津会预算这个月的花销,并且总能做到实际花销和 ...

  2. bzoj 1098 办公楼biu —— 链表+栈

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1098 首先,没有连边的人一定得在一个连通块里: 先把所有人连成一个链表,然后从第一个人开始, ...

  3. git 项目切换分支 命令

    在项目开发总,一般都会用到git管理工具,有的公司可能还是用的svn:不管怎么样.用的顺手就行: 来说下git 的基本使用 git clone + 项目地址链接: 可以把项目克隆到本地: 然后一般顺序 ...

  4. keepalived+nginx高可用实现

    1.keepalived介绍 keepalived最初是专为LVS负载均衡软件设计的,用来管理并监控LVS集群系统中各个服务节点的状态,后来又加入了实现高可用的VRRP功能.keepalived除了能 ...

  5. python中时间日期格式化符号的含义

    %y   两位数的年份表示(00-99) %Y 四位数的年份表示(000-9999) %m 月份(01-12) %d 月内中的一天(0-31) %H    24小时制小时数(0-23) %I   12 ...

  6. android 多线程 AsyncTask 下载图片

    AsyncTask 下载图片 package com.test.network; import android.graphics.Bitmap; import android.graphics.Bit ...

  7. UvaLive6441(期望概率dp)

    1.涉及负数时同时维护最大和最小,互相转移. 2.考场上最大最小混搭转移WA,赛后发现如果是小的搭小的,大的搭大的就可过,类似这种: db a = (C[i] - W[i]) * dp1[i - ][ ...

  8. April Fools Contest 2017 D

    Description Input The only line of the input contains a string of digits. The length of the string i ...

  9. adb shell getprop,setprop,watchprops更改,查看,监听系统属性

    1.简介 每个属性都有一个名称和值,他们都是字符串格式.属性被大量使用在Android系统中,用来记录系统设置或进程之间的信息交换.属性是在整个系统中全局可见的.每个进程可以get/set属性.  在 ...

  10. IOS-关闭(退)键盘事件--转

    方法: 1.手势(触背景)关闭键盘 -(void)tapBackground //在ViewDidLoad中调用{    UITapGestureRecognizer * tap = [[UITapG ...