若是系统中有一些配置文件在服务器上作了配置修改,而后后续开发又新添加一些配置项的时候,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.服务器
若是但愿保留生产服务器上所作的改动,仅仅并入新配置项, 处理方法以下:spa
git stash git pull git stash pop
而后能够使用Git diff -w +文件名 来确认代码自动合并的状况..net
反过来,若是但愿用代码库中的文件彻底覆盖本地工做版本. 方法以下:rest
git reset --hard git pull
其中git reset是针对版本,若是想针对文件回退本地修改,使用code
git checkout HEAD file/to/restore
开发
git clone http://帐号:密码@仓库get
git branch -a,列出全部分支名称it
git checkout -b dev origin/dev,做用是checkout远程的dev分支,在本地起名为dev分支,并切换到本地的dev分支