码迷,mamicode.com
首页 > 其他好文 > 详细

git使用汇总

时间:2014-07-31 21:22:37      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   使用   os   strong   io   

如果系统中有一些配置文件在服务器上做了配置修改,然后后续开发又新添加一些配置项的时候,

在发布这个配置文件的时候,会发生代码冲突:

error: Your local changes to the following files would be overwritten by merge:
        protected/config/main.php
Please, commit your changes or stash them before you can merge.

如果希望保留生产服务器上所做的改动,仅仅并入新配置项, 处理方法如下:

git stash
git pull
git stash pop

然后可以使用git diff -w +文件名 来确认代码自动合并的情况.

反过来,如果希望用代码库中的文件完全覆盖本地工作版本. 方法如下:

git reset --hard
git pull

其中git reset是针对版本,如果想针对文件回退本地修改,使用

[plain] view plaincopybubuko.com,布布扣bubuko.com,布布扣

<EMBED id=ZeroClipboardMovie_1 height=18 name=ZeroClipboardMovie_1 type=application/x-shockwave-flash align=middle pluginspage=http://www.macromedia.com/go/getflashplayer width=18 src=http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf wmode="transparent" flashvars="id=1&width=18&height=18" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false">

  1. git checkout HEAD file/to/restore  

http://blog.csdn.net/iefreer/article/details/7679631

 

git使用汇总,布布扣,bubuko.com

git使用汇总

标签:style   blog   http   color   使用   os   strong   io   

原文地址:http://my.oschina.net/u/554046/blog/296933

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!