1.我需要放弃本地的修改,用远程的库的内容就可以,应该如何做?傻傻地办法就是用心的目录重新clone一个,正确的做法是什么?
正确的做法应该是:
git fetch --all git reset --hard origin/master
git fetch 只是下载远程的库的内容,不做任何的合并git reset 把HEAD指向刚刚下载的最新的版本
2.今天在服务器上git pull是出现以下错误:
error: Your local changes to the following files would be overwritten by merge:
application/config/config.php
application/controllers/home.php
Please, commit your changes or stash them before you can merge.
Aborting
如果希望用代码库中的文件完全覆盖本地工作版本. 方法如下:
git checkout .
git pull
3.git commit 强行终止后如何操作
今天 当我 执行 git add somefile 的时候,出现 如下 错误:
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
解决方法:
rm -f ./.git/index.lock
4.git解决冲突
冲突标记<<<<<<< (7个<)与=======之间的内容是我的修改,
=======与>>>>>>>之间的内容是别人的修改。