一. 冲突的产生:在上次git同步(上传)之后,本地和远程均有更改

二. 处理

1. 丢弃本地,采用远程:

git checkout 冲突文件及其路径

如: git checkout bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp

2. 人为合并( git mergetool)本地和远程代码 (思路:先提交没有冲突的部分,再人为合并,再提交冲突的部分,最后将所有改动push上去)

1). git pull: 提示冲突

2). 提交(git add --all; git commit)

3). git pull

4). git mergetool

5). git pull
    6). git commit 
         [216-fixed-area-walk d228a46] Merge branch '216-fixed-area-walk' of 192.168.1.51:IGV/IGV01-SW into 216-fixed-area-walk

7). git add --all
    8). git commit
    9). git push origin 216-fixed-area-walk

以下是一次情况2的实际操作过程:

wang@wang:~/IGV01-SW$ git pull
Updating 502a546..9d49eeb
error: Your local changes to the following files would be overwritten by merge:
bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp
Please, commit your changes or stash them before you can merge.
Aborting
wang@wang:~/IGV01-SW$ git add --all
wang@wang:~/IGV01-SW$ git commit
[216-fixed-area-walk c8fd2d7] 添加可行区域请求程序
16 files changed, 167 insertions(+), 22 deletions(-)
create mode 100644 bzrobot_atom_tasks/bzrobot_require_access_area/CMakeLists.txt
create mode 100644 bzrobot_atom_tasks/bzrobot_require_access_area/include/bzrobot_require_access_area/require_access_area.h
create mode 100644 bzrobot_atom_tasks/bzrobot_require_access_area/launch/bzrobot_require_access_area.launch
create mode 100644 bzrobot_atom_tasks/bzrobot_require_access_area/package.xml
create mode 100644 bzrobot_atom_tasks/bzrobot_require_access_area/src/require_access_area.cpp
wang@wang:~/IGV01-SW$ git pull
Auto-merging bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp
CONFLICT (content): Merge conflict in bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp
Automatic merge failed; fix conflicts and then commit the result.
wang@wang:~/IGV01-SW$ git mergetool

This message is displayed because 'merge.tool' is not configured.
See 'git mergetool --tool-help' or 'git help config' for more details.
'git mergetool' will now attempt to use one of the following tools:
meld opendiff kdiff3 tkdiff xxdiff tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis bc3 codecompare emerge vimdiff
Merging:
bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp

Normal merge conflict for 'bzrobot_navigation_meta_packages/map_server/src/access_map_server.cpp':
{local}: modified file
{remote}: modified file
Hit return to start merge resolution tool (meld):
wang@wang:~/IGV01-SW$ git pull
You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
wang@wang:~/IGV01-SW$ git commit
[216-fixed-area-walk d228a46] Merge branch '216-fixed-area-walk' of 192.168.1.51:IGV/IGV01-SW into 216-fixed-area-walk
wang@wang:~/IGV01-SW$ git pull
Already up-to-date.

wang@wang:~/IGV01-SW$ git add --all
wang@wang:~/IGV01-SW$ git commit
[216-fixed-area-walk 44a25ff] 修改类命名
4 files changed, 15 insertions(+), 14 deletions(-)
wang@wang:~/IGV01-SW$ git push origin 216-fixed-area-walk

Counting objects: 186, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (62/62), done.
Writing objects: 100% (70/70), 6.38 KiB | 0 bytes/s, done.
Total 70 (delta 42), reused 0 (delta 0)
To git@192.168.1.51:IGV/IGV01-SW.git
9d49eeb..44a25ff 216-fixed-area-walk -> 216-fixed-area-walk

三. 从216分支上传更新至216分支的一般操作过程

1. git pull

2. git add --all

3. git commit

4. git push origin 216-fixed-area-walk

git上传(本地和远程有冲突时)的更多相关文章

  1. git 上传本地文件到github

    git 上传本地文件到github 1 git config --global user.name "Your Real Name" 2 git config --global u ...

  2. Git 上传本地项目到远程仓库 (工具篇)

    前言:前面一开始写了一篇通过命令来操作本地项目上传远程仓库的文章,后来发现此方式没有那么灵活.故跟开发同事请教了下,知道了通过工具来操作更方便.所以写了这篇文章来分享&记录. 前提条件:本地安 ...

  3. Git上传本地仓库项目到gitee远程仓库(命令篇)

    前言:最近整理了一下自己之前的自学代码,包括一些练习的项目.发现有些杂乱,故想使用Gitte(码云)管理.加上不少公司使用Git,所以写了这篇文章记录. 如果我们本地有了项目,那么如何上传到码云上呢? ...

  4. 用git上传本地项目到github上

    首先确认自己已经安装了git,打开git bash,输入ssh-keygen -t rsa -C "自己的邮箱地址@XXX.com" ,生成自己的公钥与私钥   一路默认回车,会生 ...

  5. 第一次使用Git上传本地项目到github上

    对于程序原来说都听说过GitHub,GitHub有许多开源的的项目和一些前沿的技术.因为自己在刚刚开始使用Git把自己写的一些小dome放到GitHub上遇到许多的坑,这么长时间过去了,想对第一次使用 ...

  6. git 上传本地代码到远程仓库

    未经允许,禁止转载! 查看哪些文件被修改过:git status 查看具体的修改内容:git diff 对新添加的文件进行添加:git add 文件名 提交修改标记:git commit -m &qu ...

  7. [Git]使用Git上传本地项目,并同步到Github上

    第一步:先要在github.com中创建一个仓库(New Repository). 第二步,打开Git Bash ① git init [+仓库名]:初始化仓库,执行之后可以在指定的仓库存放地上面看到 ...

  8. 使用Git上传本地项目到http://git.oschina.net

    本文前言,因倡导开源精神,我也把代码传上了开源社区,可是,当初使用http://git.oschina.net 网站上传代码的时候不知道使用工具.我竟然一个文件一个文件复制粘贴,可费了我好大一个劲儿, ...

  9. git上传本地项目到github

    git软件下载地址:https://git-scm.com/download/ 1. 在GitHub上建立项目登录GitHub后,你可以在右边靠中那里找到一个按钮“New Repository”,点击 ...

随机推荐

  1. 【nginx】 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream

    2013/10/22 20:05:49 [error] 12691#0: *6 FastCGI sent in stderr: "Primary script unknown" w ...

  2. Mysql数据库查询语法详解

    数据库的完整查询语法 在平常的工作中经常需要与数据库打交道 , 虽然大多时间都是简单的查询抑或使用框架封装好的ORM的查询方法 , 但是还是要对数据库的完整查询语法做一个加深理解 数据库完整查询语法框 ...

  3. MDK editions for Nuvoton devices

    10 Sep 2018 MDK editions for Nuvoton devices For users of Nuvoton devices, Keil® MDK increases its a ...

  4. ACM-ICPC 2018 徐州赛区网络预赛 F. Features Track

    262144K   Morgana is learning computer vision, and he likes cats, too. One day he wants to find the ...

  5. IAR调试时出现IAR one or more breakpoints could not be set and have been disabled的解决办法

    问题:在IAR调试时,单步执行的时候绿色箭头一直指向汇编界面,不指向C语言界面,并且不能在C语言界面设置断点,以及在代码编辑界面,设置断点,点调试时总提示IAR one or more breakpo ...

  6. Makefile基础(二)

    上一章:C语言之Makefile基础(一) 上一章的Makefile写的中规中矩,比较繁琐,是为了讲清楚基本概念,其实Makefile有很多灵活的写法,可以写的更简洁,同时减少出错的可能 一个目标依赖 ...

  7. day01 项目

    项目名称: 编写登陆接口 项目需求:     1 输入用户名密码     2 认证成功后显示欢迎信息     3 输错3次之后锁定,包括下次运行此程序也要锁定,涉及到持久化的问题只能用python 自 ...

  8. 带有命名空间的xml解析,C#

    前一段时间做花旗的接口,返回的xml格式是带有命名空间的,可是难倒了我,找了好久才找到解决办法,给大家分享下,少走弯路. 1,直接进入正题,先看一段带有命名空间的xml,这段xml大概的意思是,前面是 ...

  9. java启动的一些参数

    -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremo ...

  10. Selenium WebDriver-通过断言页面是否存在某些关键字来确定页面按照预期加载

    #encoding=utf-8 import unittest import time import chardet from selenium import webdriver class Visi ...