git使用汇总

若是系统中有一些配置文件在服务器上作了配置修改,而后后续开发又新添加一些配置项的时候,php

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

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.
web

若是但愿保留生产服务器上所作的改动,仅仅并入新配置项, 处理方法以下:服务器

git stash
git pull
git stash pop

而后能够使用git diff -w +文件名 来确认代码自动合并的状况.
app

反过来,若是但愿用代码库中的文件彻底覆盖本地工做版本. 方法以下:oop

git reset --hard
git pull

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

[plain] view plaincopy在CODE上查看代码片派生到个人代码片.net

<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">rest

  1. git checkout HEAD file/to/restore  code

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

 


git经常使用命令

http://justcoding.iteye.com/blog/1830388

相关文章
相关标签/搜索